Ejemplo n.º 1
0
        /// <summary>
        /// Bind the panel bar to the DataSource and cache the DataSource in the user's
        /// session to improve performance.
        /// </summary>
        private void BindPanelBarToDataSource()
        {
            NavBarData navbar   = new NavBarData();
            int        personID = CurrentPerson != null ? CurrentPerson.PersonID : -1;

            DataTable table = null;

            string navSessionkey = "CccevNavBar$" + RootPageIdSetting + "$";
            string authKey       = "CccevNavBarPersonID$";

            // don't get the table from the session if RefreshCache was requested
            if (Request.QueryString["refreshcache"] != null)
            {
                table = null;
            }
            else if (Session[navSessionkey] != null && Session[authKey] != null && (int)Session[authKey] == personID)
            {
                table = (DataTable)Session[navSessionkey];
            }
            // fetch a fresh table if the table has been set to null
            if (table == null)
            {
                table = navbar.GetNavBar_DT(Convert.ToInt32(RootPageIdSetting), personID);
                Session[navSessionkey] = table;
                // store the authenticated personID for the next check in order to ensure the user's
                // authentication has not changed since this DataSource was cached in their session.
                Session[authKey] = personID;
            }

            RadPanelbar2.DataSource = table;
            RadPanelbar2.DataBind();
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitPanelBar();
                BindPanelBarToDataSource();
            }

            // Expand the selected page and its parent chain
            pageID = Convert.ToInt32(Request.Params["page"]);
            RadPanelItem selected = RadPanelbar2.FindItemByValue(pageID.ToString());

            if (selected != null)
            {
                selected.Selected           = true;
                selected.Expanded           = true;
                selected.ChildGroupCssClass = "groupExpanded";
                selected.ExpandParentItems();
            }
        }