.net linkbutton 生成Click事件失败

页面是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

沧海一幻觉
浏览 357回答 3
3回答

人到中年有点甜

有返回Control的,是不是 加载都是control ,是从ascx路径加载的,里面的 Onclick就不能委托
打开App,查看更多内容
随时随地看视频慕课网APP