0
Answer

Get controls from an assembly

Resmi Satish

Resmi Satish

10y
568
1
I am having a webapplication project and I have to fetch the name of the pages using the webapplication dll and display the list of controls in each page.
I have to display the name of the pages in a drop down which I have done.



Code:
 var curAssemble = System.Reflection.Assembly.GetExecutingAssembly();
  System.Type[] ExistingTypes = curAssemble.GetTypes();
 
  foreach (Type pagetype in ExistingTypes)
  {

  ListItem lst = new ListItem();
  lst.Text = pagetype.Name;



  ddlPageName.Items.Add(lst);
}
  System.Web.UI.Page f = (System.Web.UI.Page)Activator.CreateInstance(pagetype);
  foreach (Control c in f.Controls)
  {

  }
I am not able to get controls from each pages in the application.

Any help from your side is appreciable.