I tried the following scenario:
There is a dropdownlist control.
Based on the selection of dropdownlist item, the user control should be loaded to the page dynamically.
There are two user controls. Here you no need to give the reference of the user control in the aspx page.
You are going to load the user control at the runtime.
Control c= null;
if (ddldropdownlist.StrSelectedValue == "Item1")
{
c= (Control)Page.LoadControl("DynamicControl.ascx");
}
else if (ddldropdownlist.StrSelectedValue == "Item2")
{
c = (Control)Page.LoadControl("DynamicControl2.ascx");
}
if( c != null)
Page.Form.Controls.Add(c)
Thanks & Regards,
V. Santhi