I have a TreeVie开发者_如何学JAVAw
in master page that is bound on each page and I want that it not to be so.
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"];
}
}
}
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.
精彩评论