Articles in this section
Category / Section

How to handle server-side ToolBarClick event?

1 min read

Grid’s ToolBarClick event can be handled in Code Behind using server-sideOnServerToolBarClick” event property. The event handler receives an argument of type Syncfusion.JavaScript.Web.GridEventArgs containing data related to this event. The following Syncfusion.JavaScript.Web.GridEventArgs members provide information specific to this event.

Table 1: Syncfusion.JavaScript.Web.GridEventArgs members




It indicates current toolbar item’s name.


It indicates current toolbar id.


It returns the current index of toolbar item.


It returns the current item.


It returns the grid model.


It returns the target item.


It returns the toolbar data.

Retrieve the Toolbar item value from server-side in ejGrid control:

The “OnServerToolBarClick” server-side event triggers the post back, once the toolbar item is clicked and maps to the corresponding event handler in Code Behind. In the server-side event handler, you can access the toolbar item values using the GridEventArgs e variable. Refer the following code examples.


<ej:Grid ID="OrdersGrid" runat="server" OnServerToolBarClick="OrdersGrid_ServerToolBarClick" OnServerExcelExporting="OrdersGrid_ServerExcelExporting" OnServerPdfExporting="OrdersGrid_ServerPdfExporting">


  protected void OrdersGrid_ServerToolBarClick(object sender, GridEventArgs e)
             var v = e.Arguments.Where(a => a.Key == "itemName").First().Value.ToString();
                     switch (v)
                           case "excelClick":
                                  OrdersGrid_ServerExcelExporting(sender, e);
                           case "pdfClick":
                                  OrdersGrid_ServerPdfExporting(sender, e);

Note: To trigger server-side events for EJ controls, you can add reference to ej.webform.min.js script file in site.master and add ScriptManager Control to the project.


<link href="Content/ej/ej.widgets.core.min.css" rel="stylesheet" />

<link href="Content/ej/flat-lime/ej.theme.min.css" rel="stylesheet" />

<script src="Scripts/jquery-1.10.2.min.js"></script>

<script src="Scripts/jsviews.min.js"></script>

<script src="Scripts/jsrender.min.js"></script>

<script src="Scripts/jquery.easing-1.3.min.js"></script>

<script src="Scripts/jquery.globalize.min.js"></script>

<script src="Scripts/ej.web.all.min.js"></script>

<script src="Scripts/ej.webform.min.js"></script>


<form id="Form2" runat="server">

<asp:ScriptManager runat="server">


. . .




A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions.The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.

The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls. If you have any queries or require clarifications, please let us know in the comments section below.

You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment