Experts, am I right about this? [TabControl insanity]

Discussion in 'ASP .Net Building Controls' started by lisa@starways.net, Jun 7, 2005.

  1. Guest

    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.
    Heh.

    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
    edit.

    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
    ignored.

    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

    http://www.starways.net/twisted/tabcontrol.zip

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

    Lisa
     
    , Jun 7, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mdb
    Replies:
    3
    Views:
    4,172
    =?Utf-8?B?TmVpbA==?=
    Sep 20, 2004
  2. Abc

    TabControl

    Abc, Jan 2, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    634
    Dhaval Faria
    Jan 2, 2004
  3. Big D

    Viewstate Insanity

    Big D, Jan 6, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    564
    Big D
    Jan 6, 2004
  4. *no spam*

    TabControl in a WebForm?

    *no spam*, Oct 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,651
    Jignesh Desai
    Oct 6, 2004
  5. Jennyfer J Barco

    tabcontrol

    Jennyfer J Barco, Feb 23, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    519
    MasterGaurav
    Feb 23, 2005
Loading...

Share This Page