第一种:
GridViewRow currRow = (GridViewRow)((LinkButton)e.CommandSource).Parent.Parent;
currRow.RowIndex取得当前行
currRow.Cells[0].Text.Trim()取得当前行的列值
第二种:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
int rowIndex = -1;
GridViewRow row = null;
switch (e.CommandName)
case "Command1": // 模板列
// 对于模板列内的按钮,我们需要显示绑定行索引到按钮的 CommandArgument 属性
// 以获取触发事件的行信息
rowIndex = Convert.ToInt32(e.CommandArgument);
row = GridView1.Rows[rowIndex];
}