473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Iterate through all panels on webform?

Hi all,

I have a page, where, because it had to all be in one page there are a
multitude of panels, with the use of a handful of conditions and the ability
to show/hide panels I am able to make this page look like the user is moving
between many...

Here's my problem...

I started off by simply seting the visibility to true/false etc in each code
block where I needed to turn them on or off - as I got more this was getting
painful, so I then created a sub, and for each panel passed in a true/false
value as a parameter...

For example

Private Sub ShowPanels(byval panel1 as boolean, byval panel2 as boolean,
byval panel3 as boolean)

panel1.visible = panel1
panel2.visible = panel2
panel3.visible = panel3

End Sub

*note, they are not named like that - its just an example!

This was working fine to start with but as I've grown the number of panels,
the parameters being passed in are getting quite big, and of course each
time I add one I have to go back through my code where I have the sub called
and update it- its getting to be a pain in my roses red....

So, what I'm looking for is something a bit clever...

What I was thinking was perhaps a sub which would iterate through a
collection of controls on the page, looking for just the "panels", once it
has all of those, set them all to visible = false apart from the ones I want
to show which would be specified in the parameters...

However, I can see some problems with this...

1. I have no idea how to iterate through the controls on the page just
looking for the panels...
2. Sometimes I need to show 1 panel, sometimes 2, something 4, so how can i
have a varying length list of parameters going in, ie, ShowPanels(panel1,
panel2, panel8) or ShowPanels(panel4, panel5)

Any help with this would be appreciated...

Its probably not the best of approaches, and I'm sure with .net 2 there are
many more clever ways of doing what I need to do - however I dont, currently
in this project have the luxury of time to learn too many new things - so
figured I'd go with something easier...

Thanks in advance for your time.

Regards

Rob
Jan 16 '07 #1
0 956

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Simon | last post by:
I've got a webform and many controls on it. I would like to iterate thru the control collection to get all the textboxes control to let me change the text property. Here is my code...for unknown...
1
by: pfnus | last post by:
Hi, I want to display different forms when the buttons are clicked and all the forms are having different controls on it. So instead of adding new windows forms to the project, i enlarged the...
0
by: dantheman | last post by:
Hi, i'm doing a programe in a few languages so i've found this code that iterates tru the forms controls and returns there names but the problem is after re-parenting the controls to optimize...
2
by: Fabian | last post by:
In my ASP.NET page I create panel controls dynamically. Now, I will loop through all my dynamically created panels. How I can do this? Thanks for help Fabian
6
by: Mike Salter | last post by:
I want to place three panels side-by-side on a webform in flowLayout. Is there an easy way to do this? TIA -- Mike
3
by: George | last post by:
In my Webform I am building in VS.NET, I need to position and reposition a number of panels at runtime from within my Code Behind. Can someone tell me what namespaces I need to import, what the...
4
by: romy | last post by:
Hi In VB.net I have a set of linkButtons controls in a form , which I want to iterate on them and change their text property. How it's done ? thanks
1
by: Ben | last post by:
Hi We have a number of Panels on our windows form, we have controls inside and outside of the panels. I am having problems tabbing between controls, it appers to be when the controls are...
2
by: Luqman | last post by:
I have a Ajax Tab Container on my Webform with One Panel and some Labels and Textboxes. I want to Iterate through all the textboxes and return their IDs. I tried every possibility I could but...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.