コード例 #1
0
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_navigatorid))
            {
                MultiView_Content.SetActiveView(View_New);
            }
            else
            {
                MultiView_Content.SetActiveView(View_Show);

                Lib.NavigatorMgr myNavigatorMgr = new Lib.NavigatorMgr();

                string _pageindexid;

                _pageindexid = Request.QueryString["PageIndexID"];

                if (_pageindexid == null)
                {
                    _pageindexid = "-1";
                }

                // Navigator Item

                List <Lib.Navigator> myNavigator = myNavigatorMgr.Get_Navigator(_pageindexid, _rootpageindexid);

                // Add Homepage Link
                if (_rootpageindexid == "-1" || DataEval.IsEmptyQuery(_rootpageindexid))
                {
                    HyperLink hlink_HomePage = new HyperLink();
                    hlink_HomePage.Text = "HomePage";

                    if (Request.QueryString["PageLink"] != "Disable")
                    {
                        hlink_HomePage.NavigateUrl = "/Default.aspx";
                    }

                    PlaceHolder_Navigator.Controls.Add(hlink_HomePage);
                }
                else
                {
                    Lib.Navigator HomeNavigator = myNavigatorMgr.Get_Navigator_Home(_rootpageindexid);

                    HyperLink hlink_HomePage = new HyperLink();
                    hlink_HomePage.Text = HomeNavigator.Menu_Title;

                    if (Request.QueryString["PageLink"] != "Disable")
                    {
                        hlink_HomePage.NavigateUrl = HomeNavigator.NavigateUrl;
                    }

                    PlaceHolder_Navigator.Controls.Add(hlink_HomePage);
                }

                // Add Navigator Link
                for (int i = 0; i < myNavigator.Count - 1; i++)
                {
                    if (_displaycategory)
                    {
                        if (myNavigator[i].IsOnNavigator)
                        {
                            // Add Navigator Sign
                            PlaceHolder_Navigator.Controls.Add(new LiteralControl(_navigatorsign));

                            // Add Navigator Link
                            HyperLink hlink_PageLink = new HyperLink();
                            hlink_PageLink.Text = myNavigator[i].Menu_Title;

                            if (Request.QueryString["PageLink"] != "Disable")
                            {
                                hlink_PageLink.NavigateUrl = myNavigator[i].NavigateUrl;
                            }

                            PlaceHolder_Navigator.Controls.Add(hlink_PageLink);
                        }
                    }
                    else
                    {
                        if (myNavigator[i].Page_Type != Core.Pages.Page_Type.Category)
                        {
                            if (myNavigator[i].IsOnNavigator)
                            {
                                // Add Navigator Sign
                                PlaceHolder_Navigator.Controls.Add(new LiteralControl(_navigatorsign));

                                // Add Navigator Link
                                HyperLink hlink_PageLink = new HyperLink();
                                hlink_PageLink.Text = myNavigator[i].Menu_Title;

                                if (Request.QueryString["PageLink"] != "Disable")
                                {
                                    hlink_PageLink.NavigateUrl = myNavigator[i].NavigateUrl;
                                }

                                PlaceHolder_Navigator.Controls.Add(hlink_PageLink);
                            }
                        }
                    }
                }

                // Add Page Name
                if (myNavigator.Count > 0)
                {
                    // Add Navigator Sign
                    PlaceHolder_Navigator.Controls.Add(new LiteralControl(_navigatorsign));

                    // Add Current Page Name
                    Literal literal_PageName = new Literal();
                    literal_PageName.Text = myNavigator[myNavigator.Count - 1].Menu_Title;

                    PlaceHolder_Navigator.Controls.Add(literal_PageName);
                }

                if (_cssclass != "Disable" || DataEval.IsEmptyQuery(_cssclass))
                {
                    Panel_Navigator.CssClass = _cssclass;
                }
            }
        }