Copy codeThe Code is as follows: 1. RowCommad
// Obtain the index
Int index = (GridViewRow) (Button) (e. CommandSource). Parent. Parent). RowIndex;
2. RowEditing
// Obtain the index
Int index = e. NewEditIndex;
// Obtain the current GridViewRow object
GridViewRow editGridViewRow = autoGridView. Rows [girdviewEditIndex];
// Method to obtain the content. One row contains the Label control.
Label girdviewTitleLabel = editGridViewRow. Cells [0]. FindControl ("titleLabel") as Label;
String gridViewContent = girdviewTitleLabel. Text;
// Method 2: whether the row contains a Label
// String gridViewContent = editGridViewRow. Cells [0]. Text;
3. RowDeleting
// Obtain the index
Int index = e. RowIndex;
// Obtain the current GridViewRow object
GridViewRow gvr = autoGridView. Rows [index];
// Obtain the text in the second cell of the current row
String str = gvr. Cells [1]. Text;