c# - how to access page load methods in other methods of a same class in asp.net -


i have method in page load:

protected void page_load(object sender, eventargs e) {     if (!ispostback)     {         ienumerable<int> ids = getids();      } } public ienumerable<int> getids() {     ienumerable<int> ids;     using ()     {         //query data end     }     return ids; } 

how can use page load ids list in other method of same class?is possible?

actually trying load data of end @ once on page load , use them in different methods of same class.

declare global variable in class.

ienumerable<int> ids; protected void page_load(object sender, eventargs e)         {              if (!ispostback)             {                  ids = getids();               }     }  public ienumerable<int> getids()    {         ienumerable<int> idstoreturn;         using ()         {                //here can ids;                  //query data end         }         return idstoreturn;     } 

Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -