Viewstate versus performance

Discussion in 'ASP .Net' started by Bigal, Aug 1, 2003.

  1. Bigal

    Bigal Guest

    If I want to create a ListBox filled by a database query, it is not
    recommended to enable the viewstate of the form,
    because it does not make sense to reconstruct the whole and costs
    performance.
    But what if I want to react on the onChange event, I do have to set
    autoRepost to true to get my selectedItem.
    It seems I need the viewstate to retrieve my selection.

    What is the best practice to do this:
    - fill list by database query
    - react on change event at the client site or with minimum overhead on
    server
    Bigal, Aug 1, 2003
    #1
    1. Advertising

  2. You don't necessarily need ViewState to do this. Assuming
    when binding the ListBox you are using a column from the
    DB that identifies a record, to populate the Value
    property of the list items you could use Request.Form
    ("ListBoxName") to retrieve the selected item(s).




    >-----Original Message-----
    >If I want to create a ListBox filled by a database query,

    it is not
    >recommended to enable the viewstate of the form,
    >because it does not make sense to reconstruct the whole

    and costs
    >performance.
    >But what if I want to react on the onChange event, I do

    have to set
    >autoRepost to true to get my selectedItem.
    >It seems I need the viewstate to retrieve my selection.
    >
    >What is the best practice to do this:
    >- fill list by database query
    >- react on change event at the client site or with

    minimum overhead on
    >server
    >
    >
    >.
    >
    Gary McCormack, Aug 1, 2003
    #2
    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. Matthew Louden
    Replies:
    1
    Views:
    6,884
    Scott M.
    Oct 11, 2003
  2. jm
    Replies:
    1
    Views:
    500
    alien2_51
    Dec 12, 2003
  3. Russ

    script versus code versus ?

    Russ, Jun 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,480
  4. Christoffer Sawicki
    Replies:
    5
    Views:
    240
    Christoffer Sawicki
    Sep 2, 2006
  5. Paul Butcher
    Replies:
    12
    Views:
    690
    Gary Wright
    Nov 28, 2007
Loading...

Share This Page