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 disable a specific button of a grid

Thread ID:





117334 Sep 29,2014 10:25 PM UTC Sep 30,2014 09:08 AM UTC ASP.NET Web Forms 1
Tags: Grid
Roimer Machacón Otero
Asked On September 29, 2014 10:25 PM UTC

Hi we are using the grid control with the toolbar.

When we've the grid without rows need disable the delete button in the toolbar, exist some form to make this?

Please a example in code behind and javascript to compare which is the best way for our application

Ragavee U S [Syncfusion]
Replied On September 30, 2014 09:08 AM UTC

Hi Nestor Alvarado Namen


Based on your requirement to disable the toolbar icon when the grid is empty, we have created a sample and the same can be downloaded from the below location.


Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/Sample935536257.zip


In the above sample, we have disabled the delete icon in the actionComplete event of the grid when the grid has no records. Please refer the below code snippet.


<ej:Grid ID="OrdersGrid" runat="server" ActionComplete="onComplete">

. . .


<script type="text/javascript">

       function onComplete(args) {          

           if ($.isEmptyObject(args.model.currentViewData)) {

               var toolbarObj = $(".e-gridtoolbar").data("ejToolbar");



           else {

               var toolbarObj = $(".e-gridtoolbar").data("ejToolbar");






Also, we suggest you to use javascript in order to achieve your requirement as it will be more optimizable than to achieve using code-behind.


Please try the above sample and get back to us if you need any further assistance.



Ragavee U S


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to 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