Automatically Gathering Control IDs - I could be being lazy!

rito1
rito1 used Ask the Experts™
on
Hi All

Now this could be me just being lazy... but say I have just created a web form with a large quantity of fields.

Within my code behind event, I need to make reference to each of the field IDs to do something wonderful with them.

At the moment I am having to go back through my form within the source view and copy and paste the field IDs to use later within my code behind.

Is there a winderful way of automatically gathering all of the IDs using within my ASp.Net page in one go?

Many thanks

Rit
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
  Dim c As Control
        c = Me.Page.FindControl("Form1")
        Dim c1 As ControlCollection
        c1 = c.Controls
        Dim i As Integer
        For i = 0 To c1.Count - 1
            Response.Write(c1(i).ID)
            Response.Write("<BR>")
        Next

whre Form1 is your form name

Author

Commented:
Excellent. Thanks pratima_mcs.

Rit

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial