日期:2014-05-18  浏览次数:20669 次

求救!Gridview 删除按钮问题
如下:在Gridview的每行添加了一个删除按钮,如果我想点击按钮后,能得知这行的名称 ,应该如何去做?(不要选中行获取,直接点击按钮的时候就获取)

1. 小马 29 三年级 删除按钮
2. 小明 25 二年级 删除按钮

------解决方案--------------------
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
GridViewRow r = GridView1.Rows[e.RowIndex] as GridViewRow;
r就是那行
}
------解决方案--------------------
前台:<asp:Button ID="Button1" CommandArgument='<%#Eval("name") %>' ></asp:Button>
后台:string str=e.CommandArgument;


ok!