页面是test.ascx
<asp:LinkButton ID="lbn_del" OnClientClick="return confirm('确认删除');" Text="删除" runat="server"></asp:LinkButton>
cs文件 继承System.Web.UI.Control
自定义的文件,方法为
.....................
.....................
protected System.Web.UI.Control GetPage()
{
System.Web.UI.Control control = null;
string path="~/content/test.ascx";
control = base.Page.LoadControl(path);
}
protected override void CreateChildControls() { System.Web.UI.Control page1= this.GetPage();
this.Init(page1); base.Controls.Add(page1); }
protecte void Init(System.Web.UI.Control page1)
{
LinkButton lbn_del = page1.FindControl("lbn_del") as LinkButton; lbn_del.Click += new EventHandler(this.lbn_del_Click);
}
void lbn_del_Click(object sender, EventArgs e){
}
-------------------------------------------------------------------------------------------------------
代码都在上面,生成的时候报错 lbn_del_Click
- 3 回答
- 0 关注
- 356 浏览
添加回答
举报
0/150
提交
取消