Button Field in Grdview control

Button Field in Grdview control

Post by BW » Wed, 07 Mar 2007 01:53:48

I am a newbie to ASP.NET and have a question about a button field I have
added to a gridview. When you click on the button I want to update a
label with the value from a datakey. the issue I have with this is that by
clicking the button it isn'tchange the selected index of the gridview. How
do I set the selected index to the current row?


Button Field in Grdview control

Post by Teemu Keis » Sat, 10 Mar 2007 02:44:59


set CommandName="Select" to the ButtonField. You'll get the index of the row
automagically in RowCommand via e.CommandArgument (even when you'd use other
command name than Select as long as RowCommand runs)

Teemu Keiski
AspInsider, ASP.NET MVP