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
Post a Comment