当前位置: 首页>>代码示例>>C#>>正文


C# MenuItem.RenderText方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.MenuItem.RenderText方法的典型用法代码示例。如果您正苦于以下问题:C# MenuItem.RenderText方法的具体用法?C# MenuItem.RenderText怎么用?C# MenuItem.RenderText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.MenuItem的用法示例。


在下文中一共展示了MenuItem.RenderText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderItem


//.........这里部分代码省略.........
                    null;
                if (navigateUrl.Length > 0 && !clickOpensThisNode) {
                    if (PageAdapter != null) {
                        PageAdapter.RenderBeginHyperlink(writer,
                                                         owner.ResolveClientUrl(navigateUrl),
                                                         true,
                                                         SR.GetString(SR.Adapter_GoLabel),
                                                         itemAccessKey != null ?
                                                          itemAccessKey :
                                                          (_currentAccessKey < 10 ?
                                                            (_currentAccessKey++).ToString(CultureInfo.InvariantCulture) :
                                                            null));
                        writer.Write(HttpUtility.HtmlEncode(item.FormattedText));
                        PageAdapter.RenderEndHyperlink(writer);
                    }
                    else {
                        HyperLink link = new HyperLink();
                        link.NavigateUrl = owner.ResolveClientUrl(navigateUrl);
                        string target = item.Target;
                        if (String.IsNullOrEmpty(target)) {
                            target = owner.Target;
                        }
                        if (!String.IsNullOrEmpty(target)) {
                            link.Target = target;
                        }
                        link.AccessKey = itemAccessKey;
                        link.Page = Page;
                        if (writer is Html32TextWriter) {
                            link.RenderBeginTag(writer);
                            SpanPanel lbl = new SpanPanel();
                            lbl.Page = Page;
                            RenderStyle(writer, lbl, linkClass, mergedStyle, applyInlineBorder);
                            lbl.RenderBeginTag(writer);
                            item.RenderText(writer);
                            lbl.RenderEndTag(writer);
                            link.RenderEndTag(writer);
                        }
                        else {
                            RenderStyle(writer, link, linkClass, mergedStyle, applyInlineBorder);
                            link.RenderBeginTag(writer);
                            item.RenderText(writer);
                            link.RenderEndTag(writer);
                        }
                    }
                }
                // Otherwise, write out a postback that will open or select the item
                else {
                    if (PageAdapter != null) {
                        PageAdapter.RenderPostBackEvent(writer,
                                                        owner.UniqueID,
                                                        (clickOpensThisNode ? 'o' : 'b') +
                                                            Escape(item.InternalValuePath),
                                                        SR.GetString(SR.Adapter_OKLabel),
                                                        item.FormattedText,
                                                        null,
                                                        itemAccessKey != null ?
                                                          itemAccessKey :
                                                          (_currentAccessKey < 10 ?
                                                         (_currentAccessKey++).ToString(CultureInfo.InvariantCulture) :
                                                         null));

                        // Expand image
                        if (clickOpensThisNode) {
                            RenderExpand(writer, item, owner);
                        }
                    }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:67,代码来源:MenuAdapter.cs

示例2: RenderItem


//.........这里部分代码省略.........
         string str8 = (((position == 0) || ((position == 1) && (depth == 0))) && (accessKey.Length != 0)) ? accessKey : null;
         if ((navigateUrl.Length > 0) && !flag3)
         {
             if (base.PageAdapter != null)
             {
                 base.PageAdapter.RenderBeginHyperlink(writer, control.ResolveClientUrl(navigateUrl), true, System.Web.SR.GetString("Adapter_GoLabel"), (str8 != null) ? str8 : ((this._currentAccessKey < 10) ? this._currentAccessKey++.ToString(CultureInfo.InvariantCulture) : null));
                 writer.Write(HttpUtility.HtmlEncode(item.FormattedText));
                 base.PageAdapter.RenderEndHyperlink(writer);
             }
             else
             {
                 HyperLink link = new HyperLink {
                     NavigateUrl = control.ResolveClientUrl(navigateUrl)
                 };
                 string target = item.Target;
                 if (string.IsNullOrEmpty(target))
                 {
                     target = control.Target;
                 }
                 if (!string.IsNullOrEmpty(target))
                 {
                     link.Target = target;
                 }
                 link.AccessKey = str8;
                 link.Page = base.Page;
                 if (writer is Html32TextWriter)
                 {
                     link.RenderBeginTag(writer);
                     SpanPanel panel2 = new SpanPanel {
                         Page = base.Page
                     };
                     this.RenderStyle(writer, panel2, str6, menuItemStyle, flag4);
                     panel2.RenderBeginTag(writer);
                     item.RenderText(writer);
                     panel2.RenderEndTag(writer);
                     link.RenderEndTag(writer);
                 }
                 else
                 {
                     this.RenderStyle(writer, link, str6, menuItemStyle, flag4);
                     link.RenderBeginTag(writer);
                     item.RenderText(writer);
                     link.RenderEndTag(writer);
                 }
             }
         }
         else if (base.PageAdapter != null)
         {
             base.PageAdapter.RenderPostBackEvent(writer, control.UniqueID, (flag3 ? 'o' : 'b') + this.Escape(item.InternalValuePath), System.Web.SR.GetString("Adapter_OKLabel"), item.FormattedText, null, (str8 != null) ? str8 : ((this._currentAccessKey < 10) ? this._currentAccessKey++.ToString(CultureInfo.InvariantCulture) : null));
             if (flag3)
             {
                 this.RenderExpand(writer, item, control);
             }
         }
         else
         {
             HyperLink link2 = new HyperLink {
                 NavigateUrl = base.Page.ClientScript.GetPostBackClientHyperlink(control, (flag3 ? 'o' : 'b') + this.Escape(item.InternalValuePath), true),
                 AccessKey = str8,
                 Page = base.Page
             };
             if (writer is Html32TextWriter)
             {
                 link2.RenderBeginTag(writer);
                 SpanPanel panel3 = new SpanPanel {
                     Page = base.Page
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:67,代码来源:MenuAdapter.cs

示例3: RenderItem

            private bool RenderItem(HtmlTextWriter writer, MenuItem item, int level, string cssClass, bool needsAccessKey) {
                RenderItemPreSeparator(writer, item);

                if (Menu.DesignMode && Menu.Orientation == Orientation.Horizontal) {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                }
                needsAccessKey = RenderItemLinkAttributes(writer, item, level, cssClass, needsAccessKey);
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                RenderItemIcon(writer, item);
                item.RenderText(writer);
                // popout image is in the A's background css
                writer.RenderEndTag();  // </a>

                RenderItemPostSeparator(writer, item);

                return needsAccessKey;
            }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:17,代码来源:MenuRendererStandards.cs


注:本文中的System.Web.UI.WebControls.MenuItem.RenderText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。