I\'ve created a page which combines an inline jQuery UI datepicker . I wan\'t to initiate a callback to the updatepanel when the user clicks a new date to update some data. Now,
I have fixed various async issues with jQuery/Updatepanels using the ScriptMode="Release" argument on the ScriptManager.
<asp:ScriptManager ID="scriptManager" runat="server" ScriptMode="Release">
</asp:ScriptManager>
I liked Tim's answer, surrounding the idea that you should be using args.get_PanelsUpdated() in the pageLoaded event. It seems like the appropriate means for doing what you're attempting to do. Try it out -- if it doesn't work, then I've got another idea up my sleeve (though its kind of dirty).
I thought this was interesting, if you add an alert after the doPostBack then FF doesn't return null.
function doAspNetPostback() {
__doPostBack('<%= hiddenOnSelectionChangedButton.ClientID %>', '');
alert('<%= hiddenOnSelectionChangedButton.ClientID %>');
}
I think you my find this article from MSDN interesting: http://msdn.microsoft.com/en-us/magazine/cc163413.aspx
The article says that "Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(" also attaches to Updatepanel complete events.
It also fires each time an asynchronous callback launched on behalf of an UpdatePanel control completes and the content inside that UpdatePanel is updated.
then in your handler you can loop through the updatedpanels with
var panels = args.get_panelsUpdated();
for (i=0; i < panels.length; i++) { alert(panels[i]); }
I would stray away from using the _ postBackSettings because of the " _ " denotes privacy and may be discontinued in future versions of asp.net ajax.
However, if I step through the code in FireBug slow enough it works
Oh? Why not give it a second to work it out?
setTimeout(function(){alert(sender._postBackSettings.panelID);},1000);
I found another script a while back that I've been using for a while now and have never had any problems with.
<script type="text/javascript">
/*
[__doPostBackAsync]
Will send an async postback to the backend
*/
function __doPostBackAsync(eventName, eventArgs) {
var prm = Sys.WebForms.PageRequestManager.getInstance();
//check first if the request queues have this item
if (!Array.contains(prm._asyncPostBackControlIDs, eventName)) {
prm._asyncPostBackControlIDs.push(eventName);
}
if (!Array.contains(prm._asyncPostBackControlClientIDs, eventName)) {
prm._asyncPostBackControlClientIDs.push(eventName);
}
__doPostBack(eventName, eventArgs);
}
</script>
You can still manually set a callback function exactly like you do in your above script.
You may also have to manually add a scriptresource handler (Can't remember which one) but I specifically remember having problems calling async and non-async post backs. Hope that helps.