Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Inject client side code in RowUpdating handler
posted

We have a web data grid (v11.1). Inside the OnRowUpdating event we, sometimes, need to set some javascript code to be run once the call returns to the client.

Are there any examples on how to do this?

We've tried a few variations of this inside the OnRowUpdating handler with no luck:

String scriptString = "<script language=JavaScript>alert('dummy string');</script>";

Page.ClientScript.RegisterClientScriptBlock(GetType(), "xxxxxx", scriptString);

Thank you

Parents
No Data
Reply
  • 49378
    posted

    Hello and_e,

    In order to register a script to be executed immediately after the response from the code behind you may want to use the RegisterStartupScript method:

            Page.ClientScript.RegisterStartupScript(Page.GetType(), "test1""alert('test1234');console.log('abc1');"true);
    

     

    Note that in order for this to work, the grids AJAX also needs to be turned off.

    As an alternative, you may be interested in using the clientside RowUpdated event of the editing core. This event will be fired
    after changes have been made on the server and the response has been sent back to the client.

    Hope this helps. Please feel free to contact me with any questions.

Children