I have a page with a gridview. The gridview has “Enable Editing” and “Enable Deleting” checked by default. I want to be able to “uncheck” either of these in the code-behind page_load event.
I found this SO question but this hides the whole commandcolumn. I only want to hide the “Edit” or “Delete” hyperlink based on the role of a user. How would I go about doing this?
Add this to your GridView: ondatabound=”GridView1_DataBound”
Separate the Command Columns in the GridView
Change the column index based on your requirements, the first column is 0