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;

좋은 웹페이지 즐겨찾기