Get GridView Cell Value

C

Chris

Hi,

In ASP.NET 2005, I am using a gridview control. I have some Buttons in
gridview for opening different forms. I use ROWCOMMAND event for
retrieving the name of the button pressed.

Can I retrieve from which row the button was pressed (ex.
grv_reports.Rows(0).Cells(4).Text) ? I have the primarykey hidden in
gridview columns and I want to send it as a parameter to the new form I
will open.


Protected Sub gridview_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs) Handles
grv_reports.RowCommand
If e.CommandName = "Send" Then

End If

Thanks a lot.
 
J

Jan Hyde

Hi,

In ASP.NET 2005, I am using a gridview control. I have some Buttons in
gridview for opening different forms. I use ROWCOMMAND event for
retrieving the name of the button pressed.

Can I retrieve from which row the button was pressed (ex.
grv_reports.Rows(0).Cells(4).Text) ? I have the primarykey hidden in
gridview columns and I want to send it as a parameter to the new form I
will open.


Protected Sub gridview_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs) Handles
grv_reports.RowCommand
If e.CommandName = "Send" Then

End If

Thanks a lot.

Take a look at the help file for

"GridView.RowCommand Event"

There is an example given there.





Jan Hyde (VB MVP)
 
C

Chris

Thanks a lot, Jan. Sometimes the property names are not very clear,
like commandargument.
 
J

Jan Hyde

Thanks a lot, Jan. Sometimes the property names are not very clear,
like commandargument.

I hear that ;-)

I also find that the help often tells me there no help
available so I go to the index and type the exact same thing
and there is the very topic I need.



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

Top