开发者

Scriptmanager RegisterStartupScript does not work on Callbacks

I am using a third party UI Library (devexpress) to implement some data grids. These grids work with Callbacks (not UpdatePanel partial Postbacks).

I am trying to use Scriptmanager RegisterStartupScript to execute some code on the client after the callback. This works great with partial postbacks but does not work with Callbacks.

Is there an开发者_开发问答y way to queue client side code for execution inside the callback server side handler?

Thanks


May I know that: do you put the control in the Update Panel?
If yes, then you may try the code below in your client side, I used to be like this but after this the code below, the problem solved :

    <script language="javascript" type="text/javascript" id="forModalPopUp">
         var prm =  Sys.WebForms.PageRequestManager.getInstance();

         prm.add_initializeRequest(InitializeRequest);
         prm.add_endRequest(EndRequest);

         function InitializeRequest(sender, args) {

         }
         function EndRequest(sender, args) {

         }

    </script>

For more information: http://oysterleelife.blogspot.com/2012/05/scripmanager-error-in-updatepanel.html

Hope it can help you. Have a nice day.


The way I ended up fixing this issue was to implement my own client side callback handler, and rewriting the functionality to run on the client as opposed to the server.


Since you're using DevExpress controls, they explain HERE that RegisterStartupScript does not work with their Callbacks. They explain there how to implement client side script with their Callbacks.

Besides what is suggeted there, since you're using their Data Grids, those grids have a Client side EndCallback event that can be used to implement client side script.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜