how many placeholders do i have on my page?

eramgarden

Contributor
Joined
Mar 8, 2004
Messages
579
I have 5 placeholders on my aspx page with 1 button, 1 label...

Anyway , in the code behind, i can grab number of placeholders I have on the page?..

I tried: page.controls.count() but that gave me 2..i think the 2 is for the button and the label..

doable?
 
I don't think those two controls correspond to the label and button. One of them should be a HtmlForm control, and the controls that you are looking for should be under that one.

To see what I am talking about, try this:

Code:
Dim ctrl as Control

For Each ctrl In Pages.Controls
    Response.Write(ctrl.GetType.ToString & " - " & ctrl.ID & "<br>")
Next

So your code should look something more like Pages.Controls(index).Controls.Count() or Form1.Controls.Count() if you get a reference of that form control.
 
Back
Top