asp.Netデータコントロールイベントインデックスを取得し、その値の総括を取得

868 ワード

 
  
1、RowCommad
//
int index = ((GridViewRow)(((Button)(e.CommandSource)).Parent.Parent)).RowIndex;

2、RowEditing
//
int index = e.NewEditIndex;
// GridViewRow
GridViewRow editGridViewRow = autoGridView.Rows[girdviewEditIndex];

// row Label
Label girdviewTitleLabel = editGridViewRow.Cells[0].FindControl("titleLabel") as Label;
string gridViewContent = girdviewTitleLabel.Text;
// row Label
//string gridViewContent = editGridViewRow.Cells[0].Text;

3、RowDeleting
//
int index=e.RowIndex ;
// GridViewRow
GridViewRow gvr=autoGridView.Rows[index];
//
string str = gvr.Cells[1].Text;