Slow page load due to viewstate

Discussion in 'ASP .Net' started by Jman, Jan 16, 2007.

  1. Jman

    Jman Guest

    I have a selection window, here are some dropdownlist if i click on an
    item in a dropdownlist the page reloads itself an puts the selected
    item in a textbox. Then i can search on the value in the textbox.
    The values in the dropdownlist is variable. In one of the dropdownlists
    there are lots of values and my viewstate is very large. My page is
    almost 3 mb. This is way too much to load every time.
    I can not set my viewstate to false because then the page doesn't work
    anymore as it should be. (The textbox doesn't fill and my dropdownlist
    becomes empty).

    I 'm searching for a way to disable the viewstate and not to do a
    postback every time i want to change something in my page.
    The person who made this page has moved to another company so i'm
    practically new to this.

    Can someone give me some way to fix my problem?
    Thanks for the help.
    Jman, Jan 16, 2007
    #1
    1. Advertising

  2. You have a couple of choices to trim down your page.

    1. Use Ajax to refresh elements on the page when a dropdown item is selected
    2. Use a wizard control (or panels - have to use panels in 1.x) to switch
    out elements. Elements that are not visible do not re-download.

    The third choice is to re-architect the page, and perhaps the application,
    to change flow.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com

    ********************************************
    Think outside the box!
    ********************************************
    "Jman" <> wrote in message
    news:...
    >I have a selection window, here are some dropdownlist if i click on an
    > item in a dropdownlist the page reloads itself an puts the selected
    > item in a textbox. Then i can search on the value in the textbox.
    > The values in the dropdownlist is variable. In one of the dropdownlists
    > there are lots of values and my viewstate is very large. My page is
    > almost 3 mb. This is way too much to load every time.
    > I can not set my viewstate to false because then the page doesn't work
    > anymore as it should be. (The textbox doesn't fill and my dropdownlist
    > becomes empty).
    >
    > I 'm searching for a way to disable the viewstate and not to do a
    > postback every time i want to change something in my page.
    > The person who made this page has moved to another company so i'm
    > practically new to this.
    >
    > Can someone give me some way to fix my problem?
    > Thanks for the help.
    >
    Cowboy \(Gregory A. Beamer\), Jan 16, 2007
    #2
    1. Advertising

  3. Not everything in a web application has to be done on server side. You can
    do many things on client side without round trips to the server. You need to
    know a bit of javascript and html for this.

    If upon a selection in the dropdown you just need to fill up a textbox, it
    is a typical client side task. If you need also to do something with the
    database, you must go to the server for this, everything depends on your
    specific requirements. You may find an compromise in Ajax.

    You can disable/enable viewstate for every control separately with the
    EnableViewState property.

    Another option for reducing the viewstate size is to disable it for the
    viewstate-hungry controls and reload them on every postback on server side.

    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "Jman" <> wrote in message
    news:...
    >I have a selection window, here are some dropdownlist if i click on an
    > item in a dropdownlist the page reloads itself an puts the selected
    > item in a textbox. Then i can search on the value in the textbox.
    > The values in the dropdownlist is variable. In one of the dropdownlists
    > there are lots of values and my viewstate is very large. My page is
    > almost 3 mb. This is way too much to load every time.
    > I can not set my viewstate to false because then the page doesn't work
    > anymore as it should be. (The textbox doesn't fill and my dropdownlist
    > becomes empty).
    >
    > I 'm searching for a way to disable the viewstate and not to do a
    > postback every time i want to change something in my page.
    > The person who made this page has moved to another company so i'm
    > practically new to this.
    >
    > Can someone give me some way to fix my problem?
    > Thanks for the help.
    >
    Eliyahu Goldin, Jan 16, 2007
    #3
    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. sck10
    Replies:
    6
    Views:
    896
    sck10
    Sep 1, 2006
  2. Fresh
    Replies:
    2
    Views:
    616
    Bo Persson
    Apr 22, 2008
  3. Josema
    Replies:
    2
    Views:
    336
  4. NEtsdpace news
    Replies:
    2
    Views:
    145
    NEtsdpace news
    Sep 29, 2004
  5. Nephi Immortal

    vector is slow due to huge array

    Nephi Immortal, Nov 11, 2011, in forum: C++
    Replies:
    3
    Views:
    386
    Jorgen Grahn
    Nov 11, 2011
Loading...

Share This Page