GridView的模版列中加入按钮,触发按钮事件后,如何获取该行的某个值?
<asp:TemplateField HeaderText="ResetPassword">
<ItemTemplate>
<asp:Button ID="ResetBtn" runat="server" CssClass="ButtonInGridView"
Text="Reset" onclick="ResetBtn_Click" />
</ItemTemplate>
</asp:TemplateField>
protected void ResetBtn_Click(object sender, EventArgs e)
{
Button btn = sender as Button;
GridViewRow row = (GridViewRow)btn.NamingContainer;
this.NameLbl.Text = row.Cells[0].Text;
}