简体   繁体   中英

Treeview in Asp.net

我在每个页面上绑定的母版页中有一个TreeView ,但我希望不要这样。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM