Groups | Blog | Home
all groups > asp.net webcontrols > december 2007 >

asp.net webcontrols : Retreiving a DataItem in the GridView's RowCommand



Nathan Sokalski
12/14/2007 10:06:19 AM
I have a GridView with a ButtonField. In the RowCommand I need to use the
value of one of the fields used in that row. I am having trouble doing this,
so I would appreciate it if someone could help me here. Thanks.
David Wier
12/14/2007 10:22:25 AM
What do you need to do with the value?

if it's a databound Gridview, you would use the onRowDatabound event.
Check out this sample:
http://www.aspnet101.com/aspnet101/aspnet/codesample.aspx?code=gvConditionalDate

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup


[quoted text, click to view]

Nathan Sokalski
12/14/2007 12:27:24 PM
This is a ButtonField, and the reason I need the value is so that I know
what SQL statement to execute on the database. The value is not being used
for display, it is being used for functionality. The RowDataBound event will
not help me here because I need to use the value in the RowCommand event, so
I need a way to access the data from the current row.

[quoted text, click to view]
AddThis Social Bookmark Button