473,624 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Contro ls

If TypeOf frmCtrl Is TextBox Then

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

End If

If frmCtrl.HasCont rols 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 1540
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.Contro ls

If TypeOf frmCtrl Is TextBox Then

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

End If

If frmCtrl.HasCont rols 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1298
by: Nick | last post by:
Hi - I'm trying to loop through the textboxes on a page to unlock them for editing. The Enabled property is set to false, and the following code is on an 'Edit' button on the form. Can anyone tell me why it doesn't work? Thanks Nick. Code:
5
1739
by: Craig G | last post by:
how do i go about this thru serverside code (VB.NET)? any links to any articles anywhere? basically i just want something simple that will loop thru all txt & cbo server side controls, and then set there back color dependant on whether they are enabled or not Cheers, Craig
6
1070
by: Craig G | last post by:
i have the routine setup as below. the ctlCollection is populated with Page.Controls. but it only ever brings back 3 controls even though there is more than this on the page the control types it returns are 1 x "System.Web.UI.ResourceBasedLiteralControl" 1 x "System.Web.UI.HtmlControls.HtmlForm" 1 x "System.Web.UI.LiteralControl" where am i going wrong?
4
2999
by: Mori | last post by:
I am using masterPage and I need to populate a textbox that is in a content control with data from popup page that is not part of the master page. This code works if no masterpage is involved. here is the javascript produced: <script>window.opener.document.forms.txtEndDate.value = '7/15/2006';self.close()</script> I basically need to populate txtEndDate on the content page. if
1
1402
by: Jim in Arizona | last post by:
Using VB .. Is there a way to loop through all drop down lists on a web form checking for a specific value (ddlDropDown.SelectedValue) and then, based on that value, cause a specific label to go visible or not? Thanks, Jim
2
16072
by: pob | last post by:
Whats the difference between using a control or a listbox when looping thru a listbox. In example 1 it dims a listbox and an example 2 it dims a control. Please explain. Thanks in advance Example 1 from Allen Browne MVP Access To use a Multiselect list box for criteria for a report, you need to loop through its ItemsSelected collection to create a string that can act as the WhereCondition for your report.
4
2533
by: Rob Meade | last post by:
Hi all, I played with my first bit of AJAX the other week and was pleasantly surprised that I achieved my goal..now I'd like to try something else.. Question... If I have an updatePanel, and lets say I have a button as a trigger which runs a function in my code behind to add a textbox to the updatePanel, when the form is submitted does this control actually "exist" as such on the
1
1201
by: rjainx | last post by:
I am using masterPage and I need to populate a textbox that is in a content control with data from popup page that is not part of the master page. here is the javascript produced: <script>window.opener.aspnetForm.ctl00_ContentPlaceHolderMain_txtCM.value='7/15/2006';self.close()</script> I basically need to populate txtCM on the content page. When you look at the source of your content page the control is renamed as...
4
5129
by: sparks | last post by:
well I am trying to get around looking at all the buttons with a case statement so I was trying this. Public Sub looking(ctlname) Dim ctl As OptionGroup Dim btn As ToggleButton ctl = Me.Controls(ctlname) ============================= For Each btn In ctl.children <<<< I know that the children doesn't make since .its just a note to myself..this is where I am stumped.
0
8688
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8352
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6115
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.