473,320 Members | 2,088 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,320 software developers and data experts.

ASP.net control tree, recursion...

I am working on an ASP.net application and I have a base class for all my
pages to inherit. In this class I have a Subroutine named ResetControls
which can go through and set certain types of controls to the defaults that I
specify. I chose to place it here so that all of my pages can use it and I
do not have to place the code on everypage. However, I noticed that if I
have a HTML table running as a server control within another table running as
a server control; the controls inside do not go to the default values that I
specify but all others not in tables do. Is there a way that I can
recursively go through the control tree to reset them so that no matter how
many nested tables are on a page they all can reset to their defaults?
Jul 21 '05 #1
3 1369
Hi

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you are going through each control
on a webform to set the default values, the child controls' value were not
set. If there is any misunderstanding, please feel free to let me know.

You're getting this behavior, because ResetControls subroutine, you didn't
set the value for the child controls. Child controls are not listed in the
controls property of a page, so we have to use ResetControls recursively.
Here is an example

When you get a control in the controls collection.

foreach(Control c in control.Controls)
{
ResetControls (c);
}

ResetControls accepts a Control type as argument to set default value
within this control.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
I tried what you gave, but it seems that when I have an HTML table running as
a server control nested within another table running as a server control, the
controls do not reset. is there a way that I can check for nested tables in
this case. The controls are not showing up in the top-most level of the
control tree. If I parse through the table, row, then cell, I can see the
control. Can I recursively go through nested tables to find controls?

Jul 21 '05 #3
Hi,

As far as I can see, there is not a general way to go though all the
controls on a page. We can directly access the controls property for child
controls, but for controls like HTML Table, we have to go into cells for
child controls. In this case, we can only write a switch case for the
exceptional situation for cases like HTML tables.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #4

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

Similar topics

0
by: t_pet422 | last post by:
Hi, I've been scouring the net and reading the PostgreSQL docs for a while now trying to learn how to create a recursive function in PL/pgSQL that will return a whole subtree given a starting...
4
by: Daniel | last post by:
I need to build the maze board(like 2d array) using a tree. But I find that my buildTree function doesn't work. Could anyone give me some hints on debugging it? Thanks bool BuildTree(TreeNodePtr...
1
by: Foodbank | last post by:
Hi, I'm currently teaching myself C data structures in preparation for a job transition and I've just passed the point in which radix sorting was covered in my book. I've recently finished a...
3
by: _DS | last post by:
Problem with mapping a directory tree to a tree control: It takes a while to recurse subdirs and map them to nodes. This is solved in some books I've seen (MacDonald, Albahari) by reading the...
4
by: Henry | last post by:
Does anybody have a real-world sample of buiding a treeview control using data from database tables? All the sample code I have found either builds the treeview manually or uses a file directory...
12
by: robertino | last post by:
Hi all, I've put together a few SPs to produce a BOM (bill of materials) listing, which together use a couple of global temp tables, and return the results from a cursor. Here's the code: ...
9
by: raylopez99 | last post by:
What's the best way of implementing a multi-node tree in C++? What I'm trying to do is traverse a tree of possible chess moves given an intial position (at the root of the tree). Since every...
4
by: Travis | last post by:
I"m looking to find (or if I can't, make) a real simple tree with a few characteristics - no sorting, I want to insert a node and specify the parent - infinite children These characteristics...
2
by: aemado | last post by:
I am writing a program that will evaluate expressions using binary trees. Most of the code has been provided, I just have to write the code for the class functions as listed in the header file....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.