Multiview, server controls and state maintenance

Discussion in 'ASP .Net Web Controls' started by ewolfman, Oct 17, 2005.

  1. ewolfman

    ewolfman Guest

    Hi all,

    I've created a TabControl webcontrol. It's quite nice and simple and
    relies on an existing Multiview's Views as tabs. On the Page_PreInit, I
    simple add the multiview control to the TabControl, and the multiview
    is rendered as a server tab control.

    The Multiview contains several comboboxes which are bound to different
    datasources (the combo boxes are design time controls and so it the
    Multiview. The TabControl is a dynamically added control which is added
    to the page on the Page_PreInit, as previously mentioned).

    protected void Page_PreInit()
    {
    TabControl tabControl = new TabControl();
    tabControl.Controls.Add(this.MultiView1);
    this.PlaceHolder1.Controls.Add(tabControl);
    }


    Here's my problem:
    When I comment-out the lines which create the TabControl and add the
    Multiview as a child control to it (i.e. the Multiview remains a child
    of the form, as designed initially in design time) - I'm required to
    load the datasources only once (using Page.IsPostback). Everything
    works fine. The comboboxes retain their states and values from postback
    to postback.

    However, when I uncomment the TabControl lines, Once posted back, the
    comboboxes are empty, and I must comment the Page.IsPostback line in
    order to reload the datasources over and over again. This works fine,
    but its clear to me that something is wrong with my TabControl.

    My guess is that the comboboxes' state is not restored for some reason
    when they are inside a multiview which is inside my tabcontrol. If so,
    then some how I must trigger this state restoration or stop
    interferring with it.

    Finally, I'd appreciate answers which will not ask me to place the
    TabControl as a design time object.

    Thanks.
    ewolfman, Oct 17, 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. Jeff S
    Replies:
    1
    Views:
    312
    Natty Gur
    Nov 4, 2003
  2. pbd22
    Replies:
    1
    Views:
    337
    pbd22
    Oct 26, 2007
  3. Scott McNair

    AJAX and State Maintenance

    Scott McNair, Dec 9, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    292
    Scott McNair
    Dec 9, 2008
  4. Andy B
    Replies:
    0
    Views:
    373
    Andy B
    Dec 29, 2008
  5. Jeremy S.

    Wizard Design and State Maintenance

    Jeremy S., Jul 27, 2009, in forum: ASP .Net
    Replies:
    12
    Views:
    697
    Gregory A. Beamer
    Jul 28, 2009
Loading...

Share This Page