removing the tool bar

Hi,

Using code-behind code for example on page load I want to remove the grid toolbar which allows the user to edit the grid.

Then on a button click, I would like to show the edit toolbar when the user clicks an edit button on the page.

is this possible?



1 Reply

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team June 7, 2018 04:07 PM UTC

Hi David, 

Thanks for contacting Syncfuson Support. 

We have checked your query and we have disable the Editing  and Toolbar settings property as false in code behind. After that we have enabled the property on client side through setModel option of the Grid. 
 
Please refer to the code example:- 
 
   protected void Page_Load(object sender, EventArgs e) 
 
        { 
 
            BindDataSource(); 
 
        } 
 
        private void BindDataSource() 
 
        {  
 
            this.FlatGrid.DataSource = order; 
 
            this.FlatGrid.DataBind(); 
 
            this.FlatGrid.ToolbarSettings.ShowToolbar= false; 
 
            this.FlatGrid.EditSettings.AllowEditing = false; 
 
            this.FlatGrid.EditSettings.AllowAdding= false; 
             
            this.FlatGrid.EditSettings.AllowDeleting= false; 
 
        } 
 
Client side:- 
 
        <button type="button" onclick="refreshData()">Enable Editing</button> 
        <ej:Grid ID="FlatGrid" runat="server" AllowPaging="True" > 
        </ej:Grid> 
     
     <script type="text/javascript"> 
         function refreshData() { 
             $('#<%= FlatGrid.ClientID %>').ejGrid("option", { editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true }, toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] } }) 
         
              
         } 
        
        </script> 
 
Please get back to us if you need any further assistance. 
 
Regards, 
 
Farveen sulthana T 
 
v

Loader.
Up arrow icon