Trigger user control post back from client side
Can a post back to the user control be triggered from javascript (on the client side) without updatepanels?
What I am trying to achieve is this
- Initially the page and the user control are loaded with default values
- The parent pages makes a PageMethod request
- When the data is available (from the PageMethod request), the user control has to be reloaded to update with the new val开发者_运维百科ues
Generating Client-Side Script for Postback
Postback Using Client-Side Script Sample
just call the preloaded function
you should find the following function in your rendered aspx page:
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
Or if you are trying to make an ajax call, you can use the jquery library instead of the update pannel:
http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/
or a demo to make an ajax enabled control
http://dotnetslackers.com/articles/ajax/aspnetajaxcontroldevelopment.aspx
Alternatives to UpdatePanel on a user control (ASCX page)
精彩评论