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.
Unfortunately, activation email could not send to your email. Please try again.

Customizing the Grid Toolbar

Thread ID:





117531 Nov 4,2014 10:46 AM Nov 5,2014 08:19 AM ASP.NET MVC 1
Tags: Grid
Fabio Melendez
Asked On November 4, 2014 10:46 AM

What is the best approach to customize the Grid Toolbar. For example I have users that will have permissions to Add rows to the grid and others that won't

I have already created the ToolbarSettings for the grid , but need to be able to make visible or enable/disable one of the buttons (ToolbarItems.Add)

My User Role is determined in the ViewBag, so for example

@if (ViewBag.LoggedUser.CanAdd)
        //Enable toolBarItems.Add button in grid

Mohammed Farook J [Syncfusion]
Replied On November 5, 2014 08:19 AM

Hi Fabio,

Thanks for using Syncfusion products.


Based on your request , we have created a sample and the same can be downloaded from the following link:


Sample: customToolbar.zip


Please find the code snippet for custom button with enable and disable toolbar option in grid.


@(Html.EJ().Button("btn").ClientSideEvents(c => c.Click("enableToolBar")).Text("EnableToolBar"))

@(Html.EJ().Button("btn1").ClientSideEvents(c => c.Click("disableToolBar")).Text("DisableToolBar"))




         .AllowPaging()    /*Paging Enabled*/

        .Columns(col =>


                . . .


<script type="text/javascript">

    function enableToolBar(args) {


        $("#FlatGrid").ejGrid("option", { toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] }, })




    function disableToolBar(args) {

        $("#FlatGrid").ejGrid("option", { toolbarSettings: { showToolbar: false}})





Please let us know if you have any queries.



J.Mohammed Farook


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.

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.