469,330 Members | 1,166 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

Looping thru asp.net controls in opener page

I was trying to do this in Javascript but found I can't do spans (which is
what Labels turn into).

I can do a loop thru a control list something like:

Public Sub LoopingControls(ByVal oControl As Control)

Dim frmCtrl As Control

oArrayList = New ArrayList

For each frmCtrl in oControl.Controls

If TypeOf frmCtrl Is TextBox Then

oArrayList.Add(New UtilityObj(frmCtrl.ID, directcast(frmCtrl,
TextBox).Text))

End If

If frmCtrl.HasControls Then

LoopingControls(frmCtrl)

End If

Next

End Sub

But I also want to do this on the opener page for a preview page. How would
I call this using the control list from my opener page?

Thanks,

Tom
Sep 6 '07 #1
1 1447
you can't with server code, only with javascript. what you are trying to
do with javascript is trivial. please read a few browser dom docs.

-- bruce (sqlwork.com)

tshad wrote:
I was trying to do this in Javascript but found I can't do spans (which is
what Labels turn into).

I can do a loop thru a control list something like:

Public Sub LoopingControls(ByVal oControl As Control)

Dim frmCtrl As Control

oArrayList = New ArrayList

For each frmCtrl in oControl.Controls

If TypeOf frmCtrl Is TextBox Then

oArrayList.Add(New UtilityObj(frmCtrl.ID, directcast(frmCtrl,
TextBox).Text))

End If

If frmCtrl.HasControls Then

LoopingControls(frmCtrl)

End If

Next

End Sub

But I also want to do this on the opener page for a preview page. How would
I call this using the control list from my opener page?

Thanks,

Tom

Sep 6 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Craig G | last post: by
6 posts views Thread by Craig G | last post: by
1 post views Thread by Jim in Arizona | last post: by
2 posts views Thread by pob | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.