我写了一个自定义控件,而且这个自定义控件有ajax方法。然后我在aspx调用,我用这样的方法调用的
ASP.FriendList_UserCls test2; protected void Page_Load(object sender, EventArgs e)
{ test2 = (ASP.FriendList_UserCls)Page.LoadControl(Request.ApplicationPath + "/NewControls/FriendList_User.ascx");
test2.labeltxt = "100004";
test2.ClickEvent += this.test2_ClickEvent;
this.PlaceHolder1.Controls.Add(test2);
}
这样添加一个 是没有任何问题的 但是我再用这样的方法添加第二个的时候,就出问题了,好像是自定义控件的js function(),只会执行一次,第二个添加的自定义控件根本不会执行了,请问这个怎么解决?Ajax自定义控件
ASP.FriendList_UserCls test2; protected void Page_Load(object sender, EventArgs e)
{ test2 = (ASP.FriendList_UserCls)Page.LoadControl(Request.ApplicationPath + "/NewControls/FriendList_User.ascx");
test2.labeltxt = "100004";
test2.ClickEvent += this.test2_ClickEvent;
this.PlaceHolder1.Controls.Add(test2);
}
这样添加一个 是没有任何问题的 但是我再用这样的方法添加第二个的时候,就出问题了,好像是自定义控件的js function(),只会执行一次,第二个添加的自定义控件根本不会执行了,请问这个怎么解决?Ajax自定义控件
string sUserControl = Request.ApplicationPath + "/NewControls/FriendList_User.ascx"
uc = Page.LoadControl(sUserControl) as UserControl;
uc.ID = "UserControl1";//这里自己设置