Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Experts, am I right about this? [TabControl insanity]

Thread Tools

Experts, am I right about this? [TabControl insanity]
Posts: n/a
I just finished working on a control that made me completely nuts.
It's a tab control, and it works beautifully in an IE browser. Just
like the kind that are used in desktop apps (multiple rows of tabs that
rearrange themselves appropriately when clicked).

The control has a collection of tabs in it. I initially tried using
CollectionBase for the collection, because I figured it'd be less work.

My major problem was that controls placed on one of the tabs manually
didn't retain their values and their events didn't get raised. And I
*knew* that was wrong, because the Microsoft MultiPage control doesn't
have that problem.

So I tried cannibalizing their control. But then I noticed that the
MultiPage control doesn't have a collection editor. And why should it?
The PageView controls have no design properties that you'd need to

So I went to look at their TabStrip, which does use a collection
editor. But those wacky folks at Microsoft... they used CollectionBase
for the TabStrip and ControlCollection for MultiPage. And you don't
place controls in a TabStrip, so they didn't have to worry about
persisting those.

Turned out that because my TabControl has a Controls property, and it
also has a Tabs property (which exposes a TabCollection), I needed to
be storing each Tab *twice*. If it wasn't stored in Tabs, the
collection editor couldn't see it. If it wasn't stored in Controls,
any controls placed on a Tab would have its ViewState and events

Which then required a custom builder, because when I'd edit the damned
collection and then switch to HTML view, the base control builder would
show both collections (Tabs and Controls), and I'd get conflicting IDs.

I had to find a way to ensure that the contents of the TabCollection
and the Controls collection stayed in sync. It was kludgy and made me
want to go and shower, but by damn, it seems to work.

It works. And it doesn't require an .htc file to be installed
anywhere. And as far as I can tell so far (wait until I beat on it
some more), it does everything that I want it to do.

But the Tabs/Controls thing really irks me. I asked a million times if
anyone here knew why I was having that problem with the child controls,
and either no one knew the answer, or no one wanted to answer, and I
suspect it was the former.

So I'm going to post the full code for the TabControl on my website
tonight. It's free for the taking. And if anyone can figure out how
it might be possible to get it to work without all of the lameass
workarounds, I would be eternally grateful.

The address is going to be

Wait until like 8pm CDT to try for it, but it should be up by then.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Menu Items is not right aligned with Right to Left documen =?Utf-8?B?QmlzaG95?= ASP .Net 0 12-28-2006 11:39 AM
Right-Click With Mouse and Toolba Buttonsr Don't Work Right Bigfoot It Is Computer Support 0 10-30-2006 06:08 PM
Tool to enable Right click on pages where Right click is disabled Computer Support 4 08-28-2005 11:53 PM
Tool to right click image in windows explorer and rotate image right or left 90 degrees siliconpi Digital Photography 2 11-29-2004 12:56 PM
pass the right form input to the right control Tom ASP .Net 0 12-11-2003 03:07 AM