GridView RowCommand event

M

Mike P

I have a ButtonField in my GridView with a CommandName, and I have a
method which I am using to capture each click of the button :

protected

void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{


if (e.CommandName == "OpportunityDetails")
{

...

}

}



My question is, how do I get hold of any of the values within the row
that I have clicked? I want to get at the ID field of the row that I
have clicked because I need to redirect to another page which will be a
DetailsView for this particular record.

Any help would be really appreciated.
 
M

Mike P

I've managed to create the same functionality like this :



<asp:HyperLinkField HeaderText="View Details" Text="View Details"
DataNavigateUrlFields="OpportunityID"

DataNavigateUrlFormatString="OpportunityDetails.aspx?OppID={0}" />


But I want to do this with a button rather than a hyperlink. Does
anybody know how to do this?
 

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