Hello.
I have a MasterPage setup in a Web Application.
Based on different button clicks i load dynamically different usercontrols in a contentplaceholder.
The problem is that i need in Site.Master to use some js code that exists in a dynamically loaded usercontrol.
That seems to be no problem for the first loaded usercontrol because the usercontrols html is included in the master page html.
The problem arrises when i dynimically load the second usercontrol i find out that the html and js from the first usercontrol loaded persists in the master page and the second usercontrol's js and html is not loaded.
If i add EnableAJAX="false" to the radajaxmanager it solves my problem .. but then again .. that beats the purpose of using ajaxmanager.
This is a code snipplet from Site.Master
I have a MasterPage setup in a Web Application.
Based on different button clicks i load dynamically different usercontrols in a contentplaceholder.
ContentPlaceHolder cph = this.FindControl("ContentPlaceHolder1") as ContentPlaceHolder; UserControl uc = this.LoadControl("~/UserControls/" + strName + ".ascx") as UserControl; if ((cph != null) && (uc != null)) { uc.ID = strName; cph.Controls.Clear(); cph.Controls.Add(uc); IsControlAdded = true; ViewState[IDS_USERCONTROL] = strName; }The problem is that i need in Site.Master to use some js code that exists in a dynamically loaded usercontrol.
That seems to be no problem for the first loaded usercontrol because the usercontrols html is included in the master page html.
The problem arrises when i dynimically load the second usercontrol i find out that the html and js from the first usercontrol loaded persists in the master page and the second usercontrol's js and html is not loaded.
If i add EnableAJAX="false" to the radajaxmanager it solves my problem .. but then again .. that beats the purpose of using ajaxmanager.
switch (index) { case 0: //Person var arr = GetSelectedPerson(); args.set_cancel(true); break; case 1: //Company break; case 2: //Group var arr = GetSelectedGroups(); break;This is a code snipplet from Site.Master
GetSelectedPerson and GetSelectedGroups are two js methods that exist in different usercontrols.