日期:2014-05-18 浏览次数:20488 次
[color=#FF0000]public[/color] void Button2_Click(object sender, System.EventArgs e) { Response .Write("<script>alert('对不起,您没有权限访问');</script>"); }
------解决方案--------------------
public void Button2_Click(object sender, System.EventArgs e)
注意是public
------解决方案--------------------
遗忘了,关注
------解决方案--------------------
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="Button1" runat="server" CommandName="btnSubmit" Text="Button" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
设置Button按钮的CommandName
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "btnSubmit")
{
GetUser(int name);
}
}
------解决方案--------------------