Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 22nd, 2006, 06:22 AM
Authorized User
 
Join Date: Jun 2006
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datacache Problem

HI Every1

I have two questions.

!st one is: I am using dataset and fill this dataset in ISPOSTBACK event.On button click event,I want to bind datagrid with this dataset but when i click on this button,data is lost.Is it possible?
I declared dataset as public.

2nd one is:How to use datacache in appliction?I want to fill dataset in global.asax page in application_start event.I want to store this dataset into datacache?how can i do this?Pls if u have any ans,pls reply me.

Thanxs
monika.

 
Old September 26th, 2006, 10:14 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Monika

Values in the dataset will be lost once the page is submitted, if you want to preserve it, you can store the datset in a viewstate and then retrieve it, eg as below:

DataSet ds = new DataSet();

//First store in viewstate
ViewState["ds"] = ds;

//then case back to dataset
ds = (DataSet) ViewState["ds"];

//for testing you can display the row count
Response.Write( ds.Tables[0].Rows.Count );

Regading caching, its simple as below:
Cache["ds"] = ds;



Regards
Mike









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.