Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 20th, 2012  |  syntax: None  |  size: 0.82 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <script runat="server">
  2.  
  3.   void AuthorsGridView_RowCommand(Object sender, GridViewCommandEventArgs e)
  4.   {
  5.  
  6.     // If multiple ButtonField column fields are used, use the
  7.     // CommandName property to determine which button was clicked.
  8.     if(e.CommandName=="Select")
  9.     {
  10.  
  11.       // Convert the row index stored in the CommandArgument
  12.       // property to an Integer.
  13.       int index = Convert.ToInt32(e.CommandArgument);    
  14.  
  15.       // Get the last name of the selected author from the appropriate
  16.       // cell in the GridView control.
  17.       GridViewRow selectedRow = AuthorsGridView.Rows[index];
  18.       TableCell lastNameCell = selectedRow.Cells[1];
  19.       string lastName = lastNameCell.Text;  
  20.  
  21.       // Display the selected author.
  22.       Message.Text = "You selected " + lastName + ".";
  23.  
  24.     }
  25.  
  26.   }
  27.  
  28. </script>