# Form Designer: How to hide the update, edit, or delete buttons in a GridView

**URL:** https://discuss.workflowgen.com/t/form-designer-how-to-hide-the-update-edit-or-delete-buttons-in-a-gridview/884
**Category:** Form Designer
**Created:** [September 26, 2017, 9:37pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-hide-the-update-edit-or-delete-buttons-in-a-gridview/884 "2017-09-26T21:37:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)
#### Post date: [September 26, 2017, 9:37pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-hide-the-update-edit-or-delete-buttons-in-a-gridview/884/1 "2017-09-26T21:37:14Z")

</div>

You can hide the **Update** , **Edit** , and **Delete** buttons in GridViews. To do this:

1. In the .NET editor, override the `OnPreLoad` method, and add a `RowDataBound` event to the GridView using the following code:

2. In the code example below, the control fields (`edit`, `delete`, and `update`) are in the fourth column (index&nbsp;3). To hide the **Edit** button in the `RowDataBound` method, add the following code:

3. To hide a different button, put the appropriate text in the `if` clause. For example:

---

<div class="post-metadata">

### Author: ![clayton](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@clayton](https://discuss.workflowgen.com/u/clayton)
#### Post date: [January 9, 2019, 6:18pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-hide-the-update-edit-or-delete-buttons-in-a-gridview/884/2 "2019-01-09T18:18:51Z")

</div>

Hi @eddy.daouk,

I am trying to hide the cancel button, when the row is in edit mode.  
I am trying to minimize the number of clicks a user needs to do on the grid.  
Is there a way we can make the cancel button hidden.

I tried using the suggested scripts above however, the button still appears.

thanks Clay

---

<div class="post-metadata">

### Author: ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)
#### Post date: [January 9, 2019, 6:25pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-hide-the-update-edit-or-delete-buttons-in-a-gridview/884/3 "2019-01-09T18:25:27Z")

</div>

Hi @clayton,

There are two things that need to be changed in the **Gridview\_RowDataBound** method above:

1- First, make sure that the code contains the correct index:  
If the button is on the second column, the index is 1, so the code will be:  
`foreach (Control c in e.Row.Cells[1].Controls){...}`  
If you indicate the wrong index, the button will not be found. Hence, the button will still appear.

2- Finally make sure that the label of the cancel button is well written in the code (Case sensitive):  
`if (b.Text == "Cancel"){...}`

Hope this helps.

Regards,  
Eddy.

---

<div class="post-metadata">

### Author: ![clayton](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@clayton](https://discuss.workflowgen.com/u/clayton)
#### Post date: [January 10, 2019, 3:11pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-hide-the-update-edit-or-delete-buttons-in-a-gridview/884/4 "2019-01-10T15:11:17Z")

</div>

Hi @eddy.daouk.

It worked! Awesome.

Thanks Clay

---

<div class="post-metadata">

### Author: ![donaldante](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@donaldante](https://discuss.workflowgen.com/u/donaldante)
#### Post date: [February 19, 2019, 10:21am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-hide-the-update-edit-or-delete-buttons-in-a-gridview/884/5 "2019-02-19T10:21:09Z")

</div>

Check this Add, Edit, Delete…[GridView example](http://asp.net-informations.com/gridview/gridview-operations.htm)
