Reputation: 1315
I have a TreeView
in master page that is bound on each page and I want that it not to be so.
Upvotes: 0
Views: 248
Reputation: 176906
User cache to store the datasorce which you are going to bind with the treeview control and on each postpaback check cache varialble is null or not.
For example like below :
public DataSet MenuTable
{
get
{
if (HttpContext.Current.Cache["MenuTable"] == null)
{
DataSet dsmenu = null;
dsmenu =GetMenuData(HttpContext.Current.Session["RolePkey"].ToString());
HttpContext.Current.Cache["MenuTable"] = dsmenu;
return dsmenu;
}
else
{
return (DataSet)HttpContext.Current.Cache["MenuTable"];
}
}
}
Upvotes: 1
Reputation: 4886
Don't place the treeview on the master page then? If you want to bind it conditionally, you could store a session state variable that specifies when the treeview is supposed to be bound.
Upvotes: 0