CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    62

    What is the best way to examine nested controls.

    I have several web server controls that are nested inside a datalist control. What is the best way to programmatically access those controls and their properties?

  2. #2
    Join Date
    Jun 2002
    Location
    Philadelphia, PA
    Posts
    85

    Re: What is the best way to examine nested controls.

    Originally posted by sager
    I have several web server controls that are nested inside a datalist control. What is the best way to programmatically access those controls and their properties?
    In C#, you can do this to reiterate over the list of controls:

    Code:
    foreach (Control c in myDataList.Controls)
    {
      Reponse.Write(c.ToString());
    }
    That will display the type of evey child control to the datalist. If you're looking for a certain control, you can search for it by type.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured