Page state on postback

  • Thread starter Thread starter bdgreen
  • Start date Start date
B

bdgreen

Hi,

This is a pretty straightforward question about postback, etc. in C#
ASP.NET.

I have 3 DropDownLists, each is bound to a SQL DataTable, created from
3 SQL queries. If the user makes a selection from a DropDownList, an
auto-postback event is triggered. But, the DataTables, which are
members of my Page class, become null on the postback. I don't want to
lose that DataTable information. There's more info in the DataTables
than the DropDownLists, which is why I want to keep them around.

So, does this mean I need to recreate the DataTables somehow and rebind
, such as repeating the SQL queries and rebinding, or serializing the
data somehow?

I'm just trying to figure out the limits of what .net does for me. Is
it limited to setting the state of controls on postback? I'm aware of
how Session["var"] and ViewState["var"] work, I just wanted to see if
I'm overlooking something, like some trick to keep variables in the
Page class around between postbacks.

At this point it seems like caching the SQL queries to recreate to
DataTables is my best bet. Lemme know if I'm missing something.

Thanks in advance
 
no replies? heh, I thought this was an easy one. I'll try to summarize
the question... Is there a way to hang onto some data (i.e. members
variables of the derived Page class) in between postbacks, other than
the standard get/post variables and the controls tied to them? (And
other than session/viewstate/cookie storage)

I realize that HTTP is stateless, I'm just wondering if .net bridged
the gap between desktop and web applications enough to hang onto
variables for each user/session.

thanks
 
Back
Top