-1

I have a gridview with a rowcommand event.

I would like the value of temp string to be used outside my rowcommand. Is this possible?

protected void gwActivity_RowCommand(object sender, GridViewCommandEventArgs e)
{
   GridViewRow row = ((e.CommandSource as Control).NamingContainer as GridViewRow);
   string temp = row.Cells[1].Text;  
}
croxy
  • 3,641
  • 8
  • 25
  • 42
Nils
  • 444
  • 3
  • 8
  • 22

1 Answers1

1

You could make a private field in your class like:

private string _temp;

and then assign your temp string to it:

protected void gwActivity_RowCommand(object sender, GridViewCommandEventArgs e)
{
   GridViewRow row = ((e.CommandSource as Control).NamingContainer as GridViewRow);
   string temp = row.Cells[1].Text;  

   _temp = temp;
}
croxy
  • 3,641
  • 8
  • 25
  • 42