Click here to Skip to main content
15,915,057 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have toggle div and some textbox,2 dropdown(for select state and city) with update panel ..at first it's work fine but when select state and city toggle fails to work...it's required pageload for work properly...but i dont want the pageload
Posted
Comments
Richard C Bishop 25-Sep-13 11:00am    
Try not using the update panel and see where that gets you.
MAYANK GEETE 26-Sep-13 6:17am    
ya i tried it ..it's work nice ..but i need update panel
Richard C Bishop 26-Sep-13 10:00am    
Why do you need it?

1 solution

The reason is once you use the UpdatePanel it refreshes the textbox and dropdown from the DOM which removes all events you have associated with it. One possibility is to use the .live() method to subscribe for events with this textbox or dropdown
$('.div2').live('blur', function (pad) {
$('.notepad').animate({ top: "95%" }, 1000);
$('#padToggle').animate({ top: "92.5%" }, 1000);
$('.notepad').blur();
});.

or you can also use :
function pageLoad(sender, args) {

// binding code here, for example
jQuery(".content").hide();
//toggle the componenet with class msg_body
jQuery(".heading").click(function () {
jQuery(this).next("content").slideToggle(300);
});
}

or
you can add an Asynchronous trigger to your page to call a JavaScript/jQuery function after any async call.
Place this code in your Page_Load() of your aspx code behind:

//This script handles ajax postbacks, by registering the js to run at the end of *AJAX* requests
Page.ClientScript.RegisterStartupScript(typeof(Page), "ajaxTrigger", "Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);", true);
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "EndRequest", "function EndRequestHandler(sender, args){AsyncDone();}", true);
 
Share this answer
 
Comments
MAYANK GEETE 1-Oct-13 3:02am    
my jquery is like that:-

$(function abc()
{

function runEffect()
{
// get effect type from
var selectedEffect = 'slide';

// most effect types need no options passed by default
var options = {};


// run the effect
$("#effect1").hide('slide');
$("#mobile_ef").hide('slide');
$("#companyadd_effc").hide('slide');
$("#pincode_effct").hide('slide');
$("#bank_effct").hide('slide');
$("#Pan_effct").hide('slide');

$( "#effect" ).toggle(selectedEffect, options, 500 );
};

// set effect from select menu value
$("#nametextbox1").dblclick(function()
{
runEffect();
return false;
});
});
how to apply code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900