Question about viewstate

Discussion in 'ASP .Net' started by Bill Yeager, Nov 7, 2004.

  1. Bill Yeager

    Bill Yeager Guest

    I have a grid that I databind with a strongly typed
    dataset which contains thousands of records retrieved
    from a database. After the dataset is retrieved from the
    database, I place it in viewstate. I need to do this
    because of the following:

    A user is allowed to check "x" amount of rows on the grid
    and submit those records (which causes a postback) to the
    database for updating. At this point, I grab the dataset
    from viewstate and simply process those records from the
    appropriate event. The records in the dataset are
    processed depending on which rows were checked on the
    grid. The syncing of rows in the grid to the dataset is
    exactly the same which is expected.

    However, based on the dataset being large, this can
    reduce performance because of the dataset which was
    placed in viewstate. If I don't place the dataset in
    viewstate and grab the records from the database again
    performing the databind, the rows that the user checked
    will be lost. Even if I somehow save the rows that were
    checked via viewstate in between postbacks and apply that
    to the dataset after the databind, the application runs
    the risk of the rows being out of sync on the datagrid to
    the dataset, because some other user could have processed
    those rows. If custom paging is implemented on the grid,
    I suppose this would reduce the work load on the data in
    viewstate which defintely would be acceptable. If not
    using custom paging, this scenario would still exist.

    Can somone please shed some light on whether or not my
    thinking is correct?
    How would one deal with this scenario?
     
    Bill Yeager, Nov 7, 2004
    #1
    1. Advertising

  2. I doubt that you can very well display thousands of records in a single HTML
    document. Perhaps you should only fetch 100 at a time.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Neither a follower
    nor a lender be.

    "Bill Yeager" <> wrote in message
    news:42c001c4c4fa$20c78030$...
    > I have a grid that I databind with a strongly typed
    > dataset which contains thousands of records retrieved
    > from a database. After the dataset is retrieved from the
    > database, I place it in viewstate. I need to do this
    > because of the following:
    >
    > A user is allowed to check "x" amount of rows on the grid
    > and submit those records (which causes a postback) to the
    > database for updating. At this point, I grab the dataset
    > from viewstate and simply process those records from the
    > appropriate event. The records in the dataset are
    > processed depending on which rows were checked on the
    > grid. The syncing of rows in the grid to the dataset is
    > exactly the same which is expected.
    >
    > However, based on the dataset being large, this can
    > reduce performance because of the dataset which was
    > placed in viewstate. If I don't place the dataset in
    > viewstate and grab the records from the database again
    > performing the databind, the rows that the user checked
    > will be lost. Even if I somehow save the rows that were
    > checked via viewstate in between postbacks and apply that
    > to the dataset after the databind, the application runs
    > the risk of the rows being out of sync on the datagrid to
    > the dataset, because some other user could have processed
    > those rows. If custom paging is implemented on the grid,
    > I suppose this would reduce the work load on the data in
    > viewstate which defintely would be acceptable. If not
    > using custom paging, this scenario would still exist.
    >
    > Can somone please shed some light on whether or not my
    > thinking is correct?
    > How would one deal with this scenario?
     
    Kevin Spencer, Nov 8, 2004
    #2
    1. Advertising

  3. Bill Yeager

    Ken Varn Guest

    What about trying to use SessionState instead? Granted, this uses more
    server memory, but it definitely will cut down on the amount of data that
    you have to pass back and forth to the client.

    --
    -----------------------------------
    Ken Varn
    Senior Software Engineer
    Diebold Inc.

    EmailID = varnk
    Domain = Diebold.com
    -----------------------------------
    "Bill Yeager" <> wrote in message
    news:42c001c4c4fa$20c78030$...
    > I have a grid that I databind with a strongly typed
    > dataset which contains thousands of records retrieved
    > from a database. After the dataset is retrieved from the
    > database, I place it in viewstate. I need to do this
    > because of the following:
    >
    > A user is allowed to check "x" amount of rows on the grid
    > and submit those records (which causes a postback) to the
    > database for updating. At this point, I grab the dataset
    > from viewstate and simply process those records from the
    > appropriate event. The records in the dataset are
    > processed depending on which rows were checked on the
    > grid. The syncing of rows in the grid to the dataset is
    > exactly the same which is expected.
    >
    > However, based on the dataset being large, this can
    > reduce performance because of the dataset which was
    > placed in viewstate. If I don't place the dataset in
    > viewstate and grab the records from the database again
    > performing the databind, the rows that the user checked
    > will be lost. Even if I somehow save the rows that were
    > checked via viewstate in between postbacks and apply that
    > to the dataset after the databind, the application runs
    > the risk of the rows being out of sync on the datagrid to
    > the dataset, because some other user could have processed
    > those rows. If custom paging is implemented on the grid,
    > I suppose this would reduce the work load on the data in
    > viewstate which defintely would be acceptable. If not
    > using custom paging, this scenario would still exist.
    >
    > Can somone please shed some light on whether or not my
    > thinking is correct?
    > How would one deal with this scenario?
     
    Ken Varn, Nov 8, 2004
    #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. Ben Rush
    Replies:
    2
    Views:
    540
    Ben Rush
    Dec 5, 2003
  2. Steph
    Replies:
    2
    Views:
    1,682
    heislord5
    May 11, 2011
  3. ujjc001
    Replies:
    0
    Views:
    1,383
    ujjc001
    Jul 27, 2005
  4. sck10
    Replies:
    6
    Views:
    929
    sck10
    Sep 1, 2006
  5. mark

    Viewstate errors... how do I get viewstate working?

    mark, Feb 20, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    293
Loading...

Share This Page