コード例 #1
0
    protected void nb_ItemClick(object source, DevExpress.Web.ASPxNavBar.NavBarItemEventArgs e)
    {
        ASPxNavBar   navbar     = source as ASPxNavBar;
        ASPxLabel    lbl        = Page.FindControl("lbl") as ASPxLabel;
        ASPxSplitter splitter   = Page.FindControl("splitter") as ASPxSplitter;
        UserControl  topgrid    = splitter.FindControl("cbpTop").FindControl("topgrid") as UserControl;
        UserControl  bottomgrid = splitter.FindControl("cbpBottom").FindControl("bottomgrid") as UserControl;

        ASPxGridView grid1 = null,
                     grid2 = null;

        if (topgrid != null)
        {
            grid1 = topgrid.FindControl("grid1") as ASPxGridView;
        }
        if (bottomgrid != null)
        {
            grid2 = bottomgrid.FindControl("grid2") as ASPxGridView;
        }

        if (e.Item.Name == "itm32")
        {
            StringBuilder result = new StringBuilder();
            if (grid1 != null)
            {
                result.AppendFormat("grid1 exists, current page is {0}", grid1.PageIndex + 1);
            }
            if (grid2 != null)
            {
                Object[] values = (Object[])grid2.GetRowValues(grid2.VisibleStartIndex + 1, new String[] { "Id", "Name", "Text" });
                result.AppendFormat("<br />grid2 exists, the second visible row values are <span style=\"Color: Red;\">{0}, {1}, {2}</span>", values[0], values[1], values[2]);
            }
            lbl.Text = result.ToString();
        }
    }
コード例 #2
0
 protected void nbMenu_ItemDataBound(object source, DevExpress.Web.ASPxNavBar.NavBarItemEventArgs e)
 {
     if (e.Item.NavigateUrl.ToLower().Contains(Request.Url.PathAndQuery.ToLower()))
     {
         e.Item.Selected       = true;
         e.Item.Group.Expanded = true;
     }
 }
コード例 #3
0
ファイル: Demo.master.cs プロジェクト: rebider/soa
    /* Main NavBar */
    protected void nbMenu_ItemDataBound(object source, DevExpress.Web.ASPxNavBar.NavBarItemEventArgs e)
    {
        e.Item.Name = e.Item.Text;

        IHierarchyData itemHierarchyData = (e.Item.DataItem as IHierarchyData);
        XmlElement     xmlElement        = itemHierarchyData.Item as XmlElement;

        if (xmlElement.Attributes["Caption"] != null)
        {
            e.Item.Name = xmlElement.Attributes["Caption"].Value;
        }

        if (string.IsNullOrEmpty(DemoName))
        {
            this.demoName = "ASPxperience";
            if (xmlElement.OwnerDocument.DocumentElement.Attributes["Name"] != null)
            {
                this.demoName = xmlElement.OwnerDocument.DocumentElement.Attributes["Name"].Value;
            }
        }

        if (GetUrl(e.Item.NavigateUrl).ToLower() == Request.AppRelativeCurrentExecutionFilePath.ToLower())
        {
            if (Request.QueryString["Section"] != null)
            {
                if (xmlElement.Attributes["Section"] == null ||
                    Request.QueryString["Section"] != xmlElement.Attributes["Section"].Value)
                {
                    return;
                }
            }
            e.Item.Selected       = true;
            e.Item.Group.Expanded = true;

            XmlAttribute useFullTitle = xmlElement.Attributes["UseFullTitle"];
            if (useFullTitle != null && !bool.Parse(useFullTitle.Value))
            {
                if (xmlElement.Attributes["Title"] != null)
                {
                    this.title = xmlElement.Attributes["Title"].Value;
                }
            }
            else
            {
                XmlNode xmlGroupNode      = xmlElement.ParentNode;
                XmlNode xmlMainNode       = xmlGroupNode.ParentNode;
                string  titleFormatString = xmlMainNode.Attributes["TitleFormatString"] != null ? xmlMainNode.Attributes["TitleFormatString"].Value : "";
                string  mainTitle         = xmlMainNode.Attributes["Title"] != null ? xmlMainNode.Attributes["Title"].Value : "";
                string  groupTitle        = xmlGroupNode.Attributes["Title"] != null ? xmlGroupNode.Attributes["Title"].Value : "";
                string  demoTitle         = xmlElement.Attributes["Title"] != null ? xmlElement.Attributes["Title"].Value : "";

                if (string.IsNullOrEmpty(titleFormatString))
                {
                    if (!string.IsNullOrEmpty(mainTitle))
                    {
                        titleFormatString = "{0}";
                    }
                    if (!string.IsNullOrEmpty(groupTitle))
                    {
                        titleFormatString += " - {1}";
                    }
                    if (!string.IsNullOrEmpty(demoTitle))
                    {
                        titleFormatString += " - {2}";
                    }
                }
                this.title = string.Format(titleFormatString, mainTitle, groupTitle, demoTitle);
            }

            foreach (XmlNode itemNode in xmlElement.ChildNodes)
            {
                switch (itemNode.Name)
                {
                case "Description": {
                    this.description = itemNode.InnerXml;
                    break;
                }

                case "GeneralTerms": {
                    this.generalTerms = itemNode.InnerXml;
                    if (itemNode.Attributes["ShowHeader"] != null &&
                        itemNode.Attributes["ShowHeader"].Value.ToLower() == "false")
                    {
                        this.showTermsHeader = false;
                    }
                    break;
                }
                }
            }
        }
    }
コード例 #4
0
    protected void nbMenu_ItemDataBound(object source, DevExpress.Web.ASPxNavBar.NavBarItemEventArgs e)
    {
        e.Item.Name = e.Item.Text;

        IHierarchyData itemHierarchyData = (e.Item.DataItem as IHierarchyData);
        XmlElement     xmlElement        = itemHierarchyData.Item as XmlElement;

        if (xmlElement.Attributes["Caption"] != null)
        {
            e.Item.Name = xmlElement.Attributes["Caption"].Value;
        }

        if (GetUrl(e.Item.NavigateUrl).ToLower() == Request.AppRelativeCurrentExecutionFilePath.ToLower())
        {
            if (Request.QueryString["Section"] != null)
            {
                if (xmlElement.Attributes["Section"] == null ||
                    Request.QueryString["Section"] != xmlElement.Attributes["Section"].Value)
                {
                    return;
                }
            }
            e.Item.Selected       = true;
            e.Item.Group.Expanded = true;

            if (xmlElement.Attributes["Title"] != null)
            {
                this.title = xmlElement.Attributes["Title"].Value;
            }

            if (xmlElement.OwnerDocument.ChildNodes[1] != null && xmlElement.OwnerDocument.ChildNodes[1].Attributes["HorizontalAlign"] != null)
            {
                switch (xmlElement.OwnerDocument.ChildNodes[1].Attributes["HorizontalAlign"].Value)
                {
                case "Left": {
                    this.horizontalAlign = HorizontalAlign.Left;
                    break;
                }
                }
            }
            foreach (XmlNode itemNode in xmlElement.ChildNodes)
            {
                switch (itemNode.Name)
                {
                case "Description": {
                    this.description = itemNode.InnerXml;
                    break;
                }

                case "GeneralTerms": {
                    this.generalTerms = itemNode.InnerXml;
                    if (itemNode.Attributes["ShowHeader"] != null &&
                        itemNode.Attributes["ShowHeader"].Value.ToLower() == "false")
                    {
                        this.showTermsHeader = false;
                    }
                    break;
                }
                }
            }
        }
    }