Sorted List Snapshot?

A

Andy Sutorius

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
 
D

Derek Harmon

Andy Sutorius said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top