We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add a custom command with server side event handling?

Platform: ASP.NET Web Forms |
Control: Grid |
Published Date: May 15, 2015 |
Last Revised Date: September 30, 2015

Sometimes you may like to handle the server side events for the custom command buttons.

Solution

Since we don’t have server side events support for custom command buttons, we can achieve it using the below workaround.

The template feature of the grid is used to bind the custom button to the grid.

ASPX

 

JS Render

 

ASPX

The OnServerRecordClick event of the Grid is enabled in order to trigger the server side record click event.

 

JS

 

The button created using column template is converted to ejButton.

 

On the click event of the button, the recordClick of the grid is explicitly triggered and the arguments are passed explicitly to the recordClick event of the grid.

 

At the server side event of the recordClick, the target details and the selectedRecord details are obtained in the GridEventArgs.

ASPX.CS

 

ADD COMMENT
You must log in to leave a comment
Comments
meir rotfleisch
Sep 27, 2015
I tried the above code and I get an exception error in the onClick() event. Reply
Ragavee U S [Syncfusion]
Sep 30, 2015
@meir: The RecordClick event was defined as a direct property in Grid. Whereas we have changed it as a property within ClientSideEvents property of grid. We have updated the KB now. Reply
meir rotfleisch
May 28, 2016
Hi I am still not able to get this to recognize that the event was triggered by the Buttons event and not just "RecordClick" event! Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon