how to know what controls are present in my web page?
-
Hello Everybody first of all thanks to all those who have replied to my earlier queries. This site is of great use to me. I have created a web page login.aspx with the following controls in it: 5 labels, 3 textboxes, 1 radiobutton list,1 checkbox list and 1 button. now i need to write a code which would display either in another webpage or as a pop-up window, the details of the controls along with their ID's in login.aspx page. the desired output should be something like: Labels: 5 (Label1, Label2, Label3, Label4, Label5). Textboxes: 3 (TextBox1, TextBox2, TextBox3). RadioButtonList: 1 (RadioButtonList1). CheckBoxList: 1 (CheckBoxList1). Buttons: 1 (Button1). Hopeto get a response to my query. Thanks in advance to all those who wish to reply to my query and yes..thanks to this site. Iam relly grateful.
Sonu
-
Hello Everybody first of all thanks to all those who have replied to my earlier queries. This site is of great use to me. I have created a web page login.aspx with the following controls in it: 5 labels, 3 textboxes, 1 radiobutton list,1 checkbox list and 1 button. now i need to write a code which would display either in another webpage or as a pop-up window, the details of the controls along with their ID's in login.aspx page. the desired output should be something like: Labels: 5 (Label1, Label2, Label3, Label4, Label5). Textboxes: 3 (TextBox1, TextBox2, TextBox3). RadioButtonList: 1 (RadioButtonList1). CheckBoxList: 1 (CheckBoxList1). Buttons: 1 (Button1). Hopeto get a response to my query. Thanks in advance to all those who wish to reply to my query and yes..thanks to this site. Iam relly grateful.
Sonu
Hashtable table=new Hashtable(); foreach (Control c in Page.Controls) { string cType = c.GetType().ToString(); if (table[cType] == null) table[cType] = new ArrayList(); (table[cType] as ArrayList).Add(c); } IEnumerator i = table.GetEnumerator(); while (i.MoveNext()) { ArrayList al = ((DictionaryEntry)i.Current).Value as ArrayList; Object o1 = al[0]; Response.Write(o1.GetType().ToString()); Response.Write(" : "); foreach (Control c in al) Response.Write(c.ID + " "); Response.Write("
"); }