Thursday, November 03, 2005

ASP.NET Control Trees

{

Debugging a problem today I wrote this, which may be useful to someone. It displays all the controls on an ASP.NET Page in a tree structure. You can actually call it from any control, it will recursively traverse the heirarchy below it. I tested it on ASP.NET 2.0, and it works fine:

Call it with the following:

DisplayControlTree(this.Controls, 1, 30);

Incidentally, the problem I had (and still have) comes from dynamically loading User Controls. Once they've been loaded using LoadControl("... path") they don't seem to persist themselves in the ViewState. I think my best hope for now is to save entries made to the User Controls by parsing the Querystring or Form collection manually.


}

1 comment:

Rod said...

You have a great blog here! I have a symptoms of diabetes site. It covers everything about symptoms of diabetes as well as diabetes care, complications, treatment and insulin. You'll find it very informative. Check it out when you can :)
Rod