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
930
JS upon initilization of grid failing: "There is a problem with the event handler method"
posted

Hi,

I'm trying to add a clientside script to my grid which will fire upon initialization. I've added the following in Page_Load:

this.UltraWebGrid1.DisplayLayout.ClientSideEvents.InitializeLayoutHandler = "alert('Hello')";

The alert is displayed allright, but after the alert I get a pop-up saying: "There is a problem with the event handler method: 'alert('Hello')'. Please check the method name's spelling."

 Anyone knows what I am doing wrong?

Parents
No Data
Reply
  • 45049
    posted

    You can't put inline JavaScript to a client-side event handler of WebGrid, nor can you choose the parameters that are passed.

    Instead, define a JavaScript function on your page that calls "alert('Hello')", and put the name of that function into the property you used.  For instance:

    function ultraWebGrid1_InitializeLayoutHandler(gridName)
    {
        alert('Hello');
    }

    this.UltraWebGrid1.DisplayLayout.ClientSideEvents.InitializeLayoutHandler = "ultraWebGrid1_InitializeLayoutHandler";
Children