VB.Net: Postback woes

~J~

~J~

Soldato
Joined
20 Oct 2003
Posts
7,558
Location
London
If I create a dataset within the PageLoad of a webform, AND, I create this only if the page is NOT a PostBack, then why can't I access my dataset later on if I attach code to another control?

Surely I don't have to attach each dataset to a viewstate do I?

Example.

If the page is loaded and it's NOT a postback then create a dataset with a table and response.write the table count of the dataset. Result = 1.

On a textbox control, when I press return (thus forcing a postback), Response.Write the table count of the dataset. Result = 0.

:confused:
 
Cheers mate.

Done something like this a while ago, it's all starting to come back now.

Can't use Session state as the session only lasts a set-period of time. I know I could increase the time on the server, but of course this is going to take up system hog.

Viewstate is an option, but it means the page been downloaded from the server is about 300k per postback. Not a great deal of data, but still a wee-bit too time consuming.

Cache is something I've not used before so will probably take a look at that.

Weird really 'cos if I bind the data to a datagrid it retains it without any problem, doing it behind the scenes in the page load I've got to store it somewhere.

Cheers anyway..
 
Back
Top Bottom