Mike P <mi*******@gmail.com>'s wild thoughts were released
on Wed, 07 Jun 2006 02:12:31 -0700 bearing the following
fruit:
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)
--
When the man hit his head on the doorway and sued, his lawyer advised to settle for a lump sum. (Gill Krebs)