예제 #1
0
        /// <devdoc>
        ///     Adds the SkipToContextText.
        /// </devdoc>

        protected internal override void RenderContents(HtmlTextWriter writer)
        {
            ControlRenderingHelper.WriteSkipLinkStart(writer, RenderingCompatibility, DesignMode, SkipLinkText, SpacerImageUrl, ClientID);

            base.RenderContents(writer);

            ControlRenderingHelper.WriteSkipLinkEnd(writer, DesignMode, SkipLinkText, ClientID);
        }
            public override void RenderBeginTag(HtmlTextWriter writer, bool staticOnly)
            {
                ControlRenderingHelper.WriteSkipLinkStart(writer, Menu.RenderingCompatibility, Menu.DesignMode, Menu.SkipLinkText, Menu.SpacerImageUrl, Menu.ClientID);

                // <table cellpadding="0" cellspacing="0" border="0" height="nodespacing">
                // Determine root menu style
                // First initialize the root menu style that depends on the control style before we change it. (VSWhidbey 354878)
                Menu.EnsureRootMenuStyle();
                if (Menu.Font != null)
                {
                    // Relative sizes should not be multiplied (VSWhidbey 457610)
                    Menu.Font.Reset();
                }
                Menu.ForeColor = Color.Empty;
                SubMenuStyle rootMenuStyle = Menu.GetSubMenuStyle(Menu.RootItem);

                if (Menu.Page != null && Menu.Page.SupportsStyleSheets)
                {
                    string styleClass = Menu.GetSubMenuCssClassName(Menu.RootItem);
                    if (styleClass.Length > 0)
                    {
                        if (Menu.CssClass.Length == 0)
                        {
                            Menu.CssClass = styleClass;
                        }
                        else
                        {
                            Menu.CssClass += ' ' + styleClass;
                        }
                    }
                }
                else
                {
                    if (rootMenuStyle != null && !rootMenuStyle.IsEmpty)
                    {
                        // Remove FontInfo and ForeColor from the submenustyle where they are not relevant
                        // but may get copied from by ControlStyle (VSWhidbey 438980)
                        rootMenuStyle.Font.Reset();
                        rootMenuStyle.ForeColor = Color.Empty;
                        // It's ok to change the control style at this point because viewstate has already been saved
                        Menu.ControlStyle.CopyFrom(rootMenuStyle);
                    }
                }

                Menu.AddAttributesToRender(writer);

                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Table);
            }
예제 #3
0
            public override void RenderEndTag(HtmlTextWriter writer, bool staticOnly)
            {
                writer.RenderEndTag();

                // Need to simulate the clear done by Javascript when we're in design mode
                if (Menu.DesignMode)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Style, "clear: left");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    writer.RenderEndTag();
                }

                ControlRenderingHelper.WriteSkipLinkEnd(writer, Menu.DesignMode, Menu.SkipLinkText, Menu.ClientID);
            }
            public override void RenderEndTag(HtmlTextWriter writer, bool staticOnly)
            {
                writer.RenderEndTag(); // Table

                // Render the submenus
                if (Menu.StaticDisplayLevels <= 1 && !staticOnly)
                {
                    bool enabled = Menu.IsEnabled;
                    for (int i = 0; i < Menu.Items.Count; i++)
                    {
                        Menu.Items[i].Render(writer, enabled, staticOnly);
                    }
                }

                ControlRenderingHelper.WriteSkipLinkEnd(writer, Menu.DesignMode, Menu.SkipLinkText, Menu.ClientID);
            }
예제 #5
0
            public override void RenderBeginTag(HtmlTextWriter writer, bool staticOnly)
            {
                ControlRenderingHelper.WriteSkipLinkStart(writer, Menu.RenderingCompatibility, Menu.DesignMode, Menu.SkipLinkText, SpacerImageUrl, Menu.ClientID);

                if (Menu.DesignMode && Menu.IncludeStyleBlock)
                {
                    // Need to render style block in design mode, since it won't be present
                    CreateStyleBlock().Render(writer);
                }

                // Add expando attributes
                if (Menu.HasAttributes)
                {
                    foreach (string key in Menu.Attributes.Keys)
                    {
                        writer.AddAttribute(key, Menu.Attributes[key]);
                    }
                }

                // CSS class, including disabled class if it's set
                string cssClass = Menu.CssClass ?? "";

                if (!Menu.Enabled)
                {
                    cssClass = (cssClass + " " + DisabledCssClass).Trim();
                }
                if (!String.IsNullOrEmpty(cssClass))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
                }

                // Need to simulate the float done by Javascript when we're in design mode
                if (Menu.DesignMode)
                {
                    writer.AddStyleAttribute("float", "left");
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Id, Menu.ClientID);
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
            }