Sorted List Snapshot?

Discussion in 'ASP .Net' started by Andy Sutorius, Jun 3, 2005.

  1. Hi,

    Setup/History: Code-behind = C#. I have created an html table with textboxes
    in each cell dynamically with asp.net. The number of rows depends on what
    the datareader brings back. The columns (6 of them) are static. After the
    table is built I take a snapshot of the names of the textboxes and the
    values inside them (before the values of the textboxes are altered by
    humans). I need to use this snapshot/data after the webpage has been
    submitted. I have a sorted list successfully recursing the controls on the
    page and storing the textbox id's and values before the submit button is
    clicked. When the button is clicked I lose what was stored in the sorted
    list.
    Objective: I need to get that snapshot (sorted list, hashtable, whatever
    works) of data from pre submit to post submit so that I can compare the
    results of pre submit and post submit textbox values.
    Constraint: No cookies. No session vars.
    My ultimate question: What can I do to get the names of the dynamically
    generated textboxes and their pre submit values to the post submit side?

    I know this sounds confusing...sorry.

    Thanks,

    Andy
    Andy Sutorius, Jun 3, 2005
    #1
    1. Advertising

  2. Andy Sutorius

    Derek Harmon Guest

    "Andy Sutorius" <> wrote in message news:nQNne.322$%...
    > Objective: I need to get that snapshot (sorted list, hashtable, whatever
    > works) of data from pre submit to post submit so that I can compare the
    > results of pre submit and post submit textbox values.
    > Constraint: No cookies. No session vars.


    Have you tried storing the data in ViewState? Provided viewstate isn't
    turned off, it will be sent down to the client as a BASE64-encoded
    value on a hidden input field, and posted back when the client submits
    the form by the underlying ASP.NET post back mechanism. The
    LoadViewState( ) method, which happens before Page_Load( ),
    will un-pack the encoded value on the hidden input field and you
    can look-up the values from ViewState.

    I'm not certain if nested SortedLists are directly serializable into
    view state, but the ViewState itself is already a dictionary, so if
    you say for each of your text fields,

    // When loading..
    textAt13 = (string)( base.ViewState[ "TextBoxRow1Col3"]);

    // When storing..
    base.ViewState[ "TextBoxRow1Col3"] = textAt13;

    you should be able to save off all your values in that way.

    ViewState is a protected property of Page. Since your
    WebForm extends Page, you can access it.


    Derek Harmon
    Derek Harmon, Jun 3, 2005
    #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. =?Utf-8?B?UCBL?=

    sorted List

    =?Utf-8?B?UCBL?=, Nov 14, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,632
    Karl Seguin
    Nov 15, 2005
  2. POM
    Replies:
    8
    Views:
    708
    Silvio Bierman
    Jun 14, 2004
  3. Gyruss
    Replies:
    1
    Views:
    3,979
    John C. Bollinger
    Apr 11, 2005
  4. Replies:
    2
    Views:
    505
    Gerard Flanagan
    Mar 22, 2006
  5. Santiago  Romero
    Replies:
    10
    Views:
    529
    Peter Otten
    Jan 21, 2008
Loading...

Share This Page