Tech Off Thread

9 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

ASP.NET ViewState

Back to Forum: Tech Off
  • User profile image
    MattShepherd

    Hi all..

    I have managed to build up a huge ViewState with data from multiple forms. Now rather than having to access each of them individually is there an easy way to loop through and find all the items of a view state and their values?

    Cheers

  • User profile image
    MattShepherd

    Ok ignore that past question guys, i was so off track i was going the wrong way..

    What im trying to do is..

    I have a site with 4 application forms.  The first 3 forms do screening to see if the person qualifies to complete the 4th page.  This validation is all done on PostBack on each page.  However, if the person makes it to page/form 4 i need to collect the data from the previous forms.  I was thinking maybe the viewstate would pass this information for me?  But im not guessing thats not going to work.

    Any ideas?  I cant used Sessions or Cookies..

    Cheers

  • User profile image
    Maurits

    hidden inputs?

  • User profile image
    dotnetjunkie

    What about the new Wizard control in ASP.NET 2.0?

    Seems like the perfect match for that job...

  • User profile image
    stevef100

    how about 4 sections contained within divs that you show hide as applicable, it keeps all the data within one form but gives the impression it's four separate  pages.
    Will work as long as the pages do not contain to many objects, otherwise it would become a maintenance nightmare...

  • User profile image
    sbc

    Just use panels for each section on one page and hide them when you go to another one.

    Public Sub ShowPanel2(Sender As Object, E As EventArgs)
        Panel1.Visible = False
        Panel2.Visible = True
        Panel3.Visible = False
        Panel4.Visible = False
    End Sub
    

    public void ShowPanel2(Object sender, EventArgs e)
    {
    
        Panel1.Visible = false;
    
        Panel2.Visible = true;
    
        Panel3.Visible = false;
    
        Panel4.Visible = false;
    }
    
    

  • User profile image
    Harlequin

    I do what sbc does. You can make some pretty powerful forms and it's all in one place. I personally prefer building everything in one control now, even large forms. CreateChildControls, OnPreRender....fun stuff Smiley

  • User profile image
    dotnetjunkie

    Seriously, try the Wizard control, it does just that, and more, but much easier and with a lot less code...

  • User profile image
    MattShepherd

    Hi Guys,

    2.0 wasnt an option as our production servers are running 1.1 of the framework.  Thanks for the pointer though.

    Went for the panel option in the end, just became a nightmare having to disable all the validation controls and then enable them on each of the "pages" as it is displayed...

    Thanks for all your advice...

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.