动态加载ascx后,点击ascx中的一个button控件,页面被刷新,而且执行不了button控件中的代码
//aspx中设定占位符
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
//aspx中动态加载ascx
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
PlaceHolder1.Controls.Add(Page.LoadControl("center_1.ascx"));
}
//center_1.ascx 中Center_IM_Bu按键的代码
protected void Center_IM_Bu_Click(object sender, ImageClickEventArgs e)
{
Page.ClientScript.RegisterStartup来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4548/viewspace-3135089/ ,如需转载,请注明出处,否则将追究法律责任。