Can I persist a dataset in an Application Variable

V

Vaughn Haybittle

Hi,

I am writing an ASP.Net application that uses a handful of dropdown lists.
These lists appear on many of the .apx pages in the application. I would
like to persist the data that is used to populatre these dropdown lists in a
dataset, and store the datasset in an application variable. I will then
databind the drowpdownlist controls to the relevant table in the dataset.

My problem is that if I create and store the dataset in an application
variable (in the Application_OnStart Method of the global.asax file), I amm
unable to referencethe data and the tables that are contained therein.

Is it possible to do this and if so how would a reference a table in the
dataset from within an .aspx page.

TIA

Vaughn
 
W

William F. Robertson, Jr.

Does this not work?

Application_OnStart
{
Application["myDataSet"] = GetDataSet();
}

Page_Load
{
DataSet data = Application["myDataSet"] as DataSet;
ddlCity.DataSource = data.Tables["tblCities"];
ddlCity.DataBind();
}

bill
 

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

Top