if you are advanced in asp.net skip to Solution.
Beginners Tutorial
When you have
updatePanel you have to register via Template , Trigger->AsyncPostBackTrigger, or Through Programatically on Page_load ex:
scriptManager.RegisterAsyncPostBackControl(mycontrol);
I've got a case which i've got JQuery autocomplete , i've got a textbox Inside UpdatePane(runat server, and have an event of TextChanged On Server)
After user click auto complete i need to Refresh the UpdatePanel. while the autocomplete is not triggering the ontextchanged event. Yes, i heard you saying this and that ..
But there is a neat way to Refresh the UpdatePanel through javascript, that is by using The solution below function.so that you have full control on updatepanel trigger.
Solution
we do know that __dopostback require us to provide clientid, and targetEventName which we are going to call
There is call back architecture but that is not the case.
how about when you have update panel, scriptmanager, and want to manualy force postback via javascript
we must register this event on the Page Request Manager.
http://bloggingabout.net/blogs/mveken/archive/2008/01/02/performing-async-postback-from-javascript.aspx
function doPostBackAsync(eventName, eventArgs) {
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (!Array.contains(prm._asyncPostBackControlIDs, eventName)) {
prm._asyncPostBackControlIDs.push(eventName);
}
if (!Array.contains(prm._asyncPostBackControlClientIDs, eventName)) {
prm._asyncPostBackControlClientIDs.push(eventName);
}
__doPostBack(eventName, eventArgs);
}
you can use it like
doPostBackAsync('<%= txtsearchauto.ClientID %>', 'OnTextChanged');
it will make async post back, call page load then the event we specify
Rocks!