Monday, November 12, 2007

Disabling Edit/Delete Button in a GridRow

This simple short piece of code is so easy, yet, when I don't use it everyday I forget it, and then I have to look it up again and again. So I will just put it here and will never have to search for it.

When there is a need to hide the delete/edit button in a grid, on a row level, in the ItemDataBound handler, place the following line:

CType(e.Item.Cells(index).Controls(0), System.Web.UI.WebControls.LinkButton).Visible = False

No comments: