asp.net获得数据控件事件索引并获取其中值总结

故里桃花落无踪,小楼轩窗山影重。若见瘦湖病西子,凋零秋风映山红。正是荷花成熟的季节,一朵朵荷花含苞怒放,满田野里的荷田闪烁着金光,一簇簇的荷花有的带着水珠乍开,有的含苞吐蕾,有的像个含羞的少女似开非开。
 
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;

以上就是asp.net获得数据控件事件索引并获取其中值总结。如果你想得到,你就会得到,你所需要付出的只是行动。更多关于asp.net获得数据控件事件索引并获取其中值总结请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
asp.net 动态生成控件并获取其值