load dataset once use dataview throughout page asp.net c#

i've been using asp for years now and dont have much experience with OOP.  i have a simple question that i cant find the answer to.
How can i load a dataset(2 datatables) on the Page_load() once and the use those tables on different events.

i have a ddl and a gridview.  on the page_load i want to load and populate the dataset - know how to do this
i have a button next to the ddl  user selects ddl value and hits button - know how to do this
onclick event of the button is onclick="button_click"
is there a way that i dont have t requery the DB and just use the datatable that i loaded

page_load()
{
   
 //connect and fill dataset
ds.Tables["Yards"]
//bind the ddl
ddl_yards.DataSource = ds.Tables["Yards"];


ds.Tables["Equip"] // datatable just made and not used yet - make this public so that the other functions can see it.  how???????

}

void button_click(Object Sender, EventArgs e)
{
  // i dont want to reconnect to the db to access the equip table every time the user click this button.
  // how can i access the "equip" datatable from inside of here that was made on the Page_load()?  so that i can bind it to a gridview - dont know how to do????????
 // do i make the dataset public? private?
 
 GridView1.DataSource = ds.Tables["Equip"];
 GridView1.DataBind();


}

cay187Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

YZlatCommented:
just declare your dataset as public outside the Page_load event
YZlatCommented:
public static DataSet ds=null;
devsolnsCommented:
keep in mind asp.net is stateless.  if you dont want to requery you need to use some sort of sessionstate.
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cay187Author Commented:
so if i load the dataset to the client the first time i need to cache it in order to reuse it again?  or save that dataset into session variables to reuse it on later events?
devsolnsCommented:
yes when you load it for the first time you can store it using session variable.  just be careful with hundreds/thousands of users this will eat server resources.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.