示例#1
0
 /// <summary>
 /// Build either a DynamicImageAnchor or a TextAnchor control for a given node
 /// </summary>
 /// <param name="startNode">The node to build the control for</param>
 /// <param name="tabMenuRowStyle">The style of the row that this control is rendered for</param>
 /// <param name="tabMenuDestinationLoadMethod">The destination load method to use</param>
 /// <param name="marginLeft">The margin left.</param>
 /// <returns>
 /// A menu item control that the user can click on
 /// </returns>
 private Control BuildMenuItemControl(SiteMapNode startNode, TabMenuRowStyle tabMenuRowStyle, TabMenuDestinationLoadMethod tabMenuDestinationLoadMethod, string marginLeft)
 {
     if (tabMenuRowStyle == TabMenuRowStyle.ImageTabs || tabMenuRowStyle == TabMenuRowStyle.ImageTabsSecondLevel)
     {
         if (tabMenuDestinationLoadMethod == TabMenuDestinationLoadMethod.BrowserRedirect)
         {
             return this.BuildDynamicImageAnchor(startNode, tabMenuRowStyle, marginLeft);
         }
         else if (tabMenuDestinationLoadMethod == TabMenuDestinationLoadMethod.ServerTransfer || tabMenuDestinationLoadMethod == TabMenuDestinationLoadMethod.ResponseRedirect)
         {
             return this.BuildDynamicImageButton(startNode, tabMenuDestinationLoadMethod, tabMenuRowStyle, marginLeft);
         }
         else
         {
             throw new InvalidOperationException("Invalid DestinationLoadMethod specified.");
         }
     }
     else
     {
         if (tabMenuDestinationLoadMethod == TabMenuDestinationLoadMethod.BrowserRedirect)
         {
             return this.BuildTextAnchor(startNode, tabMenuRowStyle, marginLeft);
         }
         else if (tabMenuDestinationLoadMethod == TabMenuDestinationLoadMethod.ServerTransfer || tabMenuDestinationLoadMethod == TabMenuDestinationLoadMethod.ResponseRedirect)
         {
             return this.BuildLinkButton(startNode, tabMenuRowStyle, tabMenuDestinationLoadMethod, marginLeft);
         }
         else
         {
             throw new InvalidOperationException("Invalid DestinationLoadMethod specified.");
         }
     }
 }
示例#2
0
        /// <summary>
        /// Builds a textual anchor control from a site map node
        /// </summary>
        /// <param name="node">The node</param>
        /// <param name="tabMenuRowStyle">The row style to render this text anchor for</param>
        /// <param name="marginLeft">The margin left.</param>
        /// <returns>An anchor containing text</returns>
        private Control BuildTextAnchor(SiteMapNode node, TabMenuRowStyle tabMenuRowStyle, string marginLeft)
        {
            HtmlAnchor anchor = new HtmlAnchor();
            anchor.Attributes["onclick"] = "return CheckNavigationStatus()";
            anchor.HRef = this.GetSiteMapNodeUrl(node);

            HtmlGenericControl span = new HtmlGenericControl("span");
            span.InnerHtml = string.Format(
                                    "{0} {1} {0}",
                                    Convert.ToChar(0x2022), // This is the dot you see surrounding secondary links.
                                    node.Title);

            anchor.Controls.Add(span);

            if (SiteMapProviderWrapper.IsCurrentNodeAChildNode(node))
            {
                if (tabMenuRowStyle == TabMenuRowStyle.TextAnchorsLightGray)
                {
                    anchor.Attributes["class"] = "TabMenuAnchorGreen Selected";
                }
                else if (tabMenuRowStyle == TabMenuRowStyle.TextAnchorsSecondLevel)
                {
                    anchor.Attributes["class"] = "TabMenuAnchorSecondLevel Selected";
                }
                else
                {
                    anchor.Attributes["class"] = "TabMenuAnchor Selected";
                }
            }
            else
            {
                if (tabMenuRowStyle == TabMenuRowStyle.TextAnchorsLightGray)
                {
                    anchor.Attributes["class"] = "TabMenuAnchorGreen";
                }
                else if (tabMenuRowStyle == TabMenuRowStyle.TextAnchorsSecondLevel)
                {
                    anchor.Attributes["class"] = "TabMenuAnchorSecondLevel";
                }
                else
                {
                    anchor.Attributes["class"] = "TabMenuAnchor";
                }
            }

            if (tabMenuRowStyle == TabMenuRowStyle.ImageTabsSecondLevel || tabMenuRowStyle == TabMenuRowStyle.TextAnchorsSecondLevel)
            {
                anchor.Style["margin-left"] = marginLeft;
            }

            return anchor;
        }
示例#3
0
        /// <summary>
        /// Builds a LinkButton control from a site map node
        /// </summary>
        /// <param name="node">The node</param>
        /// <param name="tabMenuRowStyle">The row style to render this LinkButton for</param>
        /// <param name="tabMenuDestinationLoadMethod">The Load method to use</param>
        /// <param name="marginLeft">The margin left.</param>
        /// <returns></returns>
        private Control BuildLinkButton(SiteMapNode node, TabMenuRowStyle tabMenuRowStyle, TabMenuDestinationLoadMethod tabMenuDestinationLoadMethod, string marginLeft)
        {
            LinkButton linkButton = new LinkButton();
            linkButton.CommandName = ((int)tabMenuDestinationLoadMethod).ToString();
            linkButton.CommandArgument = this.GetSiteMapNodeUrl(node);
            linkButton.Click += this.LinkButton_Click;
            linkButton.Attributes["onclick"] = "return CheckNavigationStatus()";
            linkButton.CausesValidation = false;

            linkButton.Text = string.Format(
                                 "{0} {1} {0}",
                                 Convert.ToChar(0x2022), // This is the dot you see surrounding secondary links.
                                 node.Title);

            if (SiteMapProviderWrapper.IsCurrentNodeAChildNode(node))
            {
                if (tabMenuRowStyle == TabMenuRowStyle.TextAnchorsLightGray)
                {
                    linkButton.Attributes["class"] = "TabMenuAnchorGreen Selected";
                }
                else if (tabMenuRowStyle == TabMenuRowStyle.TextAnchorsSecondLevel)
                {
                    linkButton.Attributes["class"] = "TabMenuAnchorSecondLevel Selected";
                }
                else
                {
                    linkButton.Attributes["class"] = "TabMenuAnchor Selected";
                }
            }
            else
            {
                if (tabMenuRowStyle == TabMenuRowStyle.TextAnchorsLightGray)
                {
                    linkButton.Attributes["class"] = "TabMenuAnchorGreen";
                }
                else if (tabMenuRowStyle == TabMenuRowStyle.TextAnchorsSecondLevel)
                {
                    linkButton.Attributes["class"] = "TabMenuAnchorSecondLevel";
                }
                else
                {
                    linkButton.Attributes["class"] = "TabMenuAnchor";
                }
            }

            if (tabMenuRowStyle == TabMenuRowStyle.ImageTabsSecondLevel || tabMenuRowStyle == TabMenuRowStyle.TextAnchorsSecondLevel)
            {
                linkButton.Style["margin-left"] = marginLeft;
            }

            return linkButton;
        }
示例#4
0
        /// <summary>
        /// Builds a dynamic image button control from a site map node.
        /// </summary>
        /// <param name="node">The node</param>
        /// <param name="tabMenuDestinationLoadMethod">The Load method to use</param>
        /// <param name="tabMenuRowStyle">The tab menu row style.</param>
        /// <param name="marginLeft">The margin left.</param>
        /// <returns>A dynamic image button control</returns>
        private Control BuildDynamicImageButton(SiteMapNode node, TabMenuDestinationLoadMethod tabMenuDestinationLoadMethod, TabMenuRowStyle tabMenuRowStyle, string marginLeft)
        {
            DynamicImageButton button = new DynamicImageButton();
            button.Click += this.TabImage_Click;
            button.CommandName = ((int)tabMenuDestinationLoadMethod).ToString();
            button.CommandArgument = this.GetSiteMapNodeUrl(node);
            button.CausesValidation = false;

            button.Attributes["alt"] = node.Title.ToUpper(CultureInfo.InvariantCulture);
            button.TextRenderingHint = TextRenderingHint.AntiAlias;
            button.EnableTheming = false;
            button.Selected = SiteMapProviderWrapper.IsCurrentNodeAChildNode(node);
            button.CssClass = "TabMenuImageButton";

            SetDynamicImageButtonStyles(node.Title, button, tabMenuRowStyle);

            if (tabMenuRowStyle == TabMenuRowStyle.ImageTabsSecondLevel || tabMenuRowStyle == TabMenuRowStyle.TextAnchorsSecondLevel)
            {
                button.Style["margin-left"] = marginLeft;
            }

            return button;
        }
示例#5
0
        /// <summary>
        /// Builds a dynamic image control wrapped in an anchor from a site map node.
        /// </summary>
        /// <param name="node">The node</param>
        /// <param name="tabMenuRowStyle">The tab menu row style.</param>
        /// <param name="marginLeft">The margin left.</param>
        /// <returns>
        /// A dynamic image control wrapped in an anchor
        /// </returns>
        private Control BuildDynamicImageAnchor(SiteMapNode node, TabMenuRowStyle tabMenuRowStyle, string marginLeft)
        {
            HtmlAnchor anchor = new HtmlAnchor();
            anchor.HRef = this.GetSiteMapNodeUrl(node);

            DynamicImage button = new DynamicImage();
            button.Attributes["alt"] = node.Title.ToUpper(CultureInfo.InvariantCulture);
            button.TextRenderingHint = TextRenderingHint.AntiAlias;
            button.EnableTheming = false;
            button.Selected = SiteMapProviderWrapper.IsCurrentNodeAChildNode(node);
            button.CssClass = "TabMenuImageButton";

            SetDynamicImageButtonStyles(node.Title, button, tabMenuRowStyle);

            anchor.Controls.Add(button);

            if (tabMenuRowStyle == TabMenuRowStyle.ImageTabsSecondLevel || tabMenuRowStyle == TabMenuRowStyle.TextAnchorsSecondLevel)
            {
                button.Style["margin-left"] = marginLeft;
            }

            return anchor;
        }
示例#6
0
        /// <summary>
        /// Sets the dynamic image button styles.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="button">The button.</param>
        /// <param name="tabMenuRowStyle">The tab menu row style.</param>
        private static void SetDynamicImageButtonStyles(string title, DynamicImage button, TabMenuRowStyle tabMenuRowStyle)
        {
            if (tabMenuRowStyle == TabMenuRowStyle.ImageTabs)
            {
                // Normal button style
                button.NormalStyle = new ImageStyle();
                button.NormalStyle.Text = title.ToUpper(CultureInfo.InvariantCulture);
                button.NormalStyle.TextPaddingLeft = 1;
                button.NormalStyle.TextPaddingTop = 5;
                button.NormalStyle.LeftImageUrl = "~/UIBase/Controls/TabMenu/Images/Left.gif";
                button.NormalStyle.RightImageUrl = "~/UIBase/Controls/TabMenu/Images/Right.gif";
                button.NormalStyle.BackgroundImageUrl = "~/UIBase/Controls/TabMenu/Images/Middle.gif";
                button.NormalStyle.Font.Name = "Gotham-Medium";
                button.NormalStyle.Font.Bold = true;
                button.NormalStyle.Font.Size = 10;
                button.NormalStyle.ForeColor = ColorTranslator.FromHtml("#999999");

                // Selected button style
                button.SelectedStyle = new ImageStyle();
                button.SelectedStyle.Text = title.ToUpper(CultureInfo.InvariantCulture);
                button.SelectedStyle.TextPaddingLeft = 1;
                button.SelectedStyle.TextPaddingTop = 5;
                button.SelectedStyle.LeftImageUrl = "~/UIBase/Controls/TabMenu/Images/LeftSelected.gif";
                button.SelectedStyle.RightImageUrl = "~/UIBase/Controls/TabMenu/Images/RightSelected.gif";
                button.SelectedStyle.BackgroundImageUrl = "~/UIBase/Controls/TabMenu/Images/MiddleSelected.gif";
                button.SelectedStyle.Font.Name = "Gotham-Medium";
                button.SelectedStyle.Font.Bold = true;
                button.SelectedStyle.Font.Size = 10;
                button.SelectedStyle.ForeColor = ColorTranslator.FromHtml("#666666");

                // Hover button style
                button.HoverStyle = new ImageStyle();
                button.HoverStyle.Text = title.ToUpper(CultureInfo.InvariantCulture);
                button.HoverStyle.TextPaddingLeft = 1;
                button.HoverStyle.TextPaddingTop = 5;
                button.HoverStyle.LeftImageUrl = "~/UIBase/Controls/TabMenu/Images/LeftHover.gif";
                button.HoverStyle.RightImageUrl = "~/UIBase/Controls/TabMenu/Images/RightHover.gif";
                button.HoverStyle.BackgroundImageUrl = "~/UIBase/Controls/TabMenu/Images/MiddleHover.gif";
                button.HoverStyle.Font.Name = "Gotham-Medium";
                button.HoverStyle.Font.Bold = true;
                button.HoverStyle.Font.Size = 10;
                button.HoverStyle.ForeColor = ColorTranslator.FromHtml("#666666");
            }
            else if (tabMenuRowStyle == TabMenuRowStyle.ImageTabsSecondLevel)
            {
                // Normal button style
                button.NormalStyle = new ImageStyle();
                button.NormalStyle.Text = title.ToUpper(CultureInfo.InvariantCulture);
                button.NormalStyle.TextPaddingLeft = 1;
                button.NormalStyle.TextPaddingTop = 5;
                button.NormalStyle.LeftImageUrl = "~/UIBase/Controls/TabMenu/Images/LeftSecondLevel.gif";
                button.NormalStyle.RightImageUrl = "~/UIBase/Controls/TabMenu/Images/RightSecondLevel.gif";
                button.NormalStyle.BackgroundImageUrl = "~/UIBase/Controls/TabMenu/Images/MiddleSecondLevel.gif";
                button.NormalStyle.Font.Name = "Gotham-Medium";
                button.NormalStyle.Font.Bold = true;
                button.NormalStyle.Font.Size = 10;
                button.NormalStyle.ForeColor = ColorTranslator.FromHtml("#E4470C");

                // Selected button style
                button.SelectedStyle = new ImageStyle();
                button.SelectedStyle.Text = title.ToUpper(CultureInfo.InvariantCulture);
                button.SelectedStyle.TextPaddingLeft = 1;
                button.SelectedStyle.TextPaddingTop = 5;
                button.SelectedStyle.LeftImageUrl = "~/UIBase/Controls/TabMenu/Images/LeftSelectedSecondLevel.gif";
                button.SelectedStyle.RightImageUrl = "~/UIBase/Controls/TabMenu/Images/RightSelectedSecondLevel.gif";
                button.SelectedStyle.BackgroundImageUrl = "~/UIBase/Controls/TabMenu/Images/MiddleSelectedSecondLevel.gif";
                button.SelectedStyle.Font.Name = "Gotham-Medium";
                button.SelectedStyle.Font.Bold = true;
                button.SelectedStyle.Font.Size = 10;
                button.SelectedStyle.ForeColor = ColorTranslator.FromHtml("#666666");

                // Hover button style
                button.HoverStyle = new ImageStyle();
                button.HoverStyle.Text = title.ToUpper(CultureInfo.InvariantCulture);
                button.HoverStyle.TextPaddingLeft = 1;
                button.HoverStyle.TextPaddingTop = 5;
                button.HoverStyle.LeftImageUrl = "~/UIBase/Controls/TabMenu/Images/LeftSelectedSecondLevel.gif";
                button.HoverStyle.RightImageUrl = "~/UIBase/Controls/TabMenu/Images/RightSelectedSecondLevel.gif";
                button.HoverStyle.BackgroundImageUrl = "~/UIBase/Controls/TabMenu/Images/MiddleSelectedSecondLevel.gif";
                button.HoverStyle.Font.Name = "Gotham-Medium";
                button.HoverStyle.Font.Bold = true;
                button.HoverStyle.Font.Size = 10;
                button.HoverStyle.ForeColor = ColorTranslator.FromHtml("#666666");
            }
        }
示例#7
0
        /// <summary>
        /// Builds a Div control for one level of the menu
        /// </summary>
        /// <param name="tabMenuRowStyle">The row style for the row</param>
        /// <returns>Div control</returns>
        private static HtmlGenericControl BuildMenuDiv(TabMenuRowStyle tabMenuRowStyle)
        {
            HtmlGenericControl div = new HtmlGenericControl("div");
            switch (tabMenuRowStyle)
            {
                case TabMenuRowStyle.ImageTabs:
                    div.Attributes.Add("class", "DivImageTabs");
                    break;
                case TabMenuRowStyle.ImageTabsSecondLevel:
                    div.Attributes.Add("class", "DivImageTabsSecondLevel");
                    break;
                case TabMenuRowStyle.TextAnchorsDarkGray:
                    div.Attributes.Add("class", "DivTextAnchorsDarkGray");
                    break;
                case TabMenuRowStyle.TextAnchorsMediumGray:
                    div.Attributes.Add("class", "DivTextAnchorsMediumGray");
                    break;
                case TabMenuRowStyle.TextAnchorsLightGray:
                    div.Attributes.Add("class", "DivTextAnchorsLightGray");
                    break;
                case TabMenuRowStyle.TextAnchorsSecondLevel:
                    div.Attributes.Add("class", "DivTextAnchorsSecondLevel");
                    break;
                case TabMenuRowStyle.Hidden:
                    div.Visible = false;
                    break;
                default:
                    div.Attributes.Remove("class");
                    break;
            }

            return div;
        }