开发者

Trigger user control post back from client side

开发者 https://www.devze.com 2022-12-26 09:48 出处:网络
Can a post back to the user control be triggered from javascript (on the client side) without updatepanels?

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

  1. Initially the page and the user control are loaded with default values
  2. The parent pages makes a PageMethod request
  3. 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)

0

精彩评论

暂无评论...
验证码 换一张
取 消