Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to know what controls are present in my web page?

how to know what controls are present in my web page?

Scheduled Pinned Locked Moved ASP.NET
databasetutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sonu T
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • S Sonu T

      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

      M Offline
      M Offline
      MIHAI_MTZ
      wrote on last edited by
      #2

      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("
      "); }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups