当我尝试调试时,我看到我的按钮为空。谁知道为什么?这是代码。提前谢谢!
protected void Delete_Click(object sender, EventArgs e)
{
con.Open();
Button btn = sender as Button;
GridViewRow row = (GridViewRow)btn.NamingContainer;
Label headerAthleteID = (Label)row.FindControl("lblAthleteID");
con.Close();
}
这是我的网格视图部分
<asp:TemplateField SortExpression="deleteColumn">
<ItemTemplate>
<asp:Button ID ="deleteButton" runat="server" Text="Delete" OnClick="Delete_Click" />
</ItemTemplate>
</asp:TemplateField>