disable edit button in gridview

M

Mike P

How do you disable the edit button for selected rows in a gridview?
Here is my button :

<asp:CommandField ShowEditButton="True" ButtonType="Link"
ShowCancelButton="True"
UpdateText="Update"
EditText="Edit" CancelText="Cancel" />
 
J

Jan Hyde

Mike P <[email protected]>'s wild thoughts were released
How do you disable the edit button for selected rows in a gridview?
Here is my button :

<asp:CommandField ShowEditButton="True" ButtonType="Link"
ShowCancelButton="True"
UpdateText="Update"
EditText="Edit" CancelText="Cancel" />
Is this button seperate from the grid?

Anyway, when you select a row the SelectedIndexChanged event
should fire, you can set the enabled property of your button
there based on whatever your criteria is


If your asking how to disable the edit button (part of the
grid) on specific rows then I'd first set it to a template
column.

Then in the RowDataBoundEvent you can get at the button for
each row using

cmd = e.Row.FindControl("YourButtonName")

Then set the enabled property as per your requirements.




Jan Hyde (VB MVP)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top