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


C# HtmlTag.AddClass方法代码示例

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


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

示例1: BuildLabel

        //this is hideous but wanted to show an idea.
        public HtmlTag BuildLabel(BehaviorNode behaviorNode)
        {
            // TODO -- come back and policize this

            var span = new HtmlTag("span").AddClass("label");
            var pp = behaviorNode.GetType().PrettyPrint();
            span.Text("behavior");

            if (pp.StartsWith("WebForm"))
            {
                span.Text("View");
                span.AddClass("notice");
            }
            else if (pp.StartsWith("Call"))
            {
                span.AddClass("warning");
                span.Text("continuation");
            }
            else if (!behaviorNode.GetType().Name.StartsWith("Fubu"))
            {
                span.Text("fubu");
            }

            return span;
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:26,代码来源:IChainVisualizerBuilder.cs

示例2: AdminForm

        public static HtmlString AdminForm(DocumentNode Model, string adminUrl, string divClassName = "")
        {
            var div = new HtmlTag("div");

            if (divClassName != "") div.AddClass(divClassName);

            var form = new FormTag().Method("post").Action("#");

            form.Append(HtmlBuilder.HtmlTagLabelInput("Name (header)", "name", Model.Name));
            form.Append(new HtmlTag("input").Attr("type", "submit").Attr("name", "update").Attr("value", "Update"));
            form.Append(HtmlBuilder.HtmlTagLabelCheckbox("Hide header", "hideHeader", Model.HideHeader));
            form.Append(HtmlBuilder.HtmlTagLabelTextArea("Body text", "body", Model.Body));
            form.Append(HtmlBuilder.HtmlTagLabelTextArea("Extra content 1", "extraContent1", Model.ExtraContent1, 5));
            //form.Append(HtmlBuilder.HtmlTagLabelTextArea("Extra content 2", "extraContent2", Model.ExtraContent2, 5));
            //form.Append(HtmlBuilder.HtmlTagLabelTextArea("Extra content 3", "extraContent3", Model.ExtraContent3, 3));
            form.Append(HtmlBuilder.HtmlTagLabelInput("Author", "author", Model.Author));
            form.Append(HtmlBuilder.HtmlTagLabelInput("ViewPath", "viewPath", Model.ViewPath));
            form.Append(HtmlBuilder.HtmlTagLabelCheckbox("Hidden", "isHidden", Model.IsHidden));
            form.Append(HtmlBuilder.HtmlTagLabelCheckbox("Deleted", "isDeleted", Model.IsDeleted));
            form.Append(new HtmlTag("input").Attr("type", "submit").Attr("name", "update").Attr("value", "Update"));

            if (!String.IsNullOrEmpty(Model.Url))
            {
                form.Append(new HtmlTag("p").Append(new HtmlTag("a").Attr("href", Model.Url).Text("View page")));
            }

            div.Append(form);
            return new HtmlString(div.ToHtmlString());
        }
开发者ID:Programenta,项目名称:NodeTreeCms,代码行数:29,代码来源:HtmlAdmin.cs

示例3: createTags

        private static IEnumerable<HtmlTag> createTags(IEnumerable<LogEntry> entries)
        {
            foreach (LogEntry log in entries)
            {
                var text = "{0} in {1} milliseconds".ToFormat(log.Description, log.TimeInMilliseconds);
                if (!log.Success)
                {
                    text += " -- Failed!";
                }

                var headerTag = new HtmlTag("h4").Text(text).AddClass("log");

                yield return headerTag;

                if (log.TraceText.IsNotEmpty())
                {
                    var traceTag = new HtmlTag("pre").AddClass("log").Text(log.TraceText);
                    if (!log.Success)
                    {
                        traceTag.AddClass("failure");
                    }

                    yield return traceTag;
                }

                yield return new HtmlTag("hr");
            }
        }
开发者ID:RobertTheGrey,项目名称:fubumvc,代码行数:28,代码来源:EntryLogWriter.cs

示例4: Menu

        public static HtmlTag Menu(this IFubuPage page, string menuName = null)
        {
            var navigationService = page.Get<INavigationService>();
            var securityContext = page.Get<ISecurityContext>();
            var items = navigationService.MenuFor(new NavigationKey(menuName ?? StringConstants.BlogName));
            var menu = new HtmlTag("ul");


            items.Each(x =>
            {
                var link = new LinkTag(x.Key, x.Url);
                var li = new HtmlTag("li");

                if (x.Key.Equals("Logout") && x.MenuItemState == MenuItemState.Available)
                {
                    var spanTag = new HtmlTag("span");
                    spanTag.Text(string.Format("Welcome, {0}", securityContext.CurrentIdentity.Name));
                    menu.Append(spanTag);
                }

                if (x.MenuItemState == MenuItemState.Active)
                    li.AddClass("current");

                if(x.MenuItemState == MenuItemState.Active || x.MenuItemState == MenuItemState.Available)
                    menu.Append(li.Append(link));

            });

            return menu;
        }
开发者ID:mtscout6,项目名称:FubuMVC.Blog,代码行数:30,代码来源:PageExtensions.cs

示例5: Modify

        public virtual void Modify(HtmlTag form)
        {
            if (!_modify) return;

            form.Data("validation-mode", _value.ToLower());
            form.AddClass("validated-form");
        }
开发者ID:emiaj,项目名称:fubuvalidation,代码行数:7,代码来源:ValidationMode.cs

示例6: setDisabledState

 private static void setDisabledState(MenuItemToken item, HtmlTag link)
 {
     if (item.MenuItemState == MenuItemState.Disabled)
     {
         link.AddClass("disabled");
     }
 }
开发者ID:synhershko,项目名称:FubuMVC.Bootstrap,代码行数:7,代码来源:MenuItemTag.cs

示例7: WriteResults

        public void WriteResults(Counts counts)
        {
            var countsTag = new HtmlTag("div").AddClass("results");
            if (counts.WasSuccessful())
            {
                countsTag.Text("Succeeded with " + counts.ToString());
                countsTag.AddClass("results-" + HtmlClasses.PASS);
            }
            else
            {
                countsTag.Text("Failed with " + counts.ToString());
                countsTag.AddClass("results-" + HtmlClasses.FAIL);
            }

            _suiteName.Next = countsTag;
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:16,代码来源:TestHolderTag.cs

示例8: Build

 public override HtmlTag Build(ElementRequest request)
 {
     HtmlTag root = new HtmlTag("div");
     root.AddClass("KYT_ListDisplayRoot");
     var selectListItems = request.RawValue as IEnumerable<string>;
     if (selectListItems == null) return root;
     selectListItems.Each(item=> root.Child(new HtmlTag("div").Text(item)));
     return root;
 }
开发者ID:reharik,项目名称:KnowYourTurf,代码行数:9,代码来源:ListDisplayBuilder.cs

示例9: InputConventions

        public InputConventions()
        {
            Editors.Always
                .Modify((request, tag) => tag.Attr("id", request.Accessor.Name));

            Editors
                .If(x => x.Accessor.FieldName.Contains("Password") && x.Accessor.PropertyType.IsString())
                .Attr("type", "password");

            Editors
                .If(x => x.Accessor.FieldName.Contains("Email") && x.Accessor.PropertyType.IsString())
                .Attr("type", "email");

            Editors
                .If(x => x.Accessor.FieldName.Contains("Body") && x.Accessor.PropertyType.IsString())
                .Modify((r, x) =>
                            {
                                x.TagName("textarea");
                                x.Text(r.StringValue());
                            });

            Editors
                .If(x => x.Accessor.InnerProperty.HasAttribute<RequiredAttribute>())
                .Modify(x => x.AddClass("required"));

            Editors
                .If(x => x.Accessor.InnerProperty.HasAttribute<MinLengthAttribute>())
                .Modify((request, tag) =>
                {
                    var length = request.Accessor.InnerProperty.GetAttribute<MinLengthAttribute>().Length;
                    tag.Attr("minlength", length);
                });

            Editors
                .If(x => x.Accessor.InnerProperty.HasAttribute<MaxLengthAttribute>())
                .Modify((request, tag) =>
                {
                    var length = request.Accessor.InnerProperty.GetAttribute<MaxLengthAttribute>().Length;
                    tag.Attr("maxlength", length);
                });

            Editors.Always
                .Modify((request, tag) =>
                            {
                                var result = request.Get<IFubuRequest>().Get<ValidationResult>();
                                if (result == null || result.IsValid) return;
                                var error = result.Errors.FirstOrDefault(x => x.PropertyName == request.Accessor.InnerProperty.Name);
                                if (error == null) return;

                                var errorLabel = new HtmlTag("label");
                                errorLabel.Text(error.ErrorMessage);
                                errorLabel.AddClass("error");
                                errorLabel.Attr("for", request.Accessor.InnerProperty.Name);
                                errorLabel.Attr("generated", "true");
                                tag.Next = errorLabel;
                            });
        }
开发者ID:marcusswope,项目名称:Hit-That-Line,代码行数:57,代码来源:InputConventions.cs

示例10: AddNumberClasses

 private static void AddNumberClasses(RequestData r, HtmlTag h)
 {
     if (r.Accessor.PropertyType == typeof(int) || r.Accessor.PropertyType == typeof(int?)
         || r.Accessor.PropertyType == typeof(uint) || r.Accessor.PropertyType == typeof(uint?)
         || r.Accessor.PropertyType == typeof(long) || r.Accessor.PropertyType == typeof(long?)
         || r.Accessor.PropertyType == typeof(ulong) || r.Accessor.PropertyType == typeof(ulong?)
         || r.Accessor.PropertyType == typeof(short) || r.Accessor.PropertyType == typeof(short?)
         || r.Accessor.PropertyType == typeof(ushort) || r.Accessor.PropertyType == typeof(ushort?))
     {
         h.AddClass("digits");
     }
     else if (r.Accessor.PropertyType == typeof(double) || r.Accessor.PropertyType == typeof(double?)
         || r.Accessor.PropertyType == typeof(decimal) || r.Accessor.PropertyType == typeof(decimal?)
         || r.Accessor.PropertyType == typeof(float) || r.Accessor.PropertyType == typeof(float?))
     {
         h.AddClass("number");
     }
 }
开发者ID:eByte23,项目名称:SchoStack,代码行数:18,代码来源:DataAnnotationHtmlConventions.cs

示例11: FontAwesome

 public static HtmlTag FontAwesome(this HtmlHelper htmlHelper, string icon, params string[] options)
 {
     var tag = new HtmlTag("span").AddClass("fa").AddClass(FAPrefix(icon));
     foreach (var item in options)
     {
         tag.AddClass(FAPrefix(item));
     }
     return tag;
 }
开发者ID:SharpSeeEr,项目名称:SharpNET.Utilities,代码行数:9,代码来源:GeneralHtmlHelpers.cs

示例12: GetRatingStars

		public static HtmlTag GetRatingStars(int rating)
		{
			var t = new HtmlTag("span");

			for (int i = 0; i < rating; i++)
			{
				var img = new HtmlTag("img");
				img.Attr("src", "/Public/images/rating.png");
				img.AddClass("ratingImage");
				t.Append(img);
			}

			return t;
		}
开发者ID:NTCoding,项目名称:FubuRaven.NTCoding.com,代码行数:14,代码来源:ViewHelper.cs

示例13: writeChildren

        private void writeChildren(MenuItemToken item, HtmlTag link)
        {
            link.AddClass("dropdown-toggle");
            link.Attr("data-toggle", "dropdown");

            link.Add("b").AddClass("caret");

            var ul = Add("ul").AddClass("dropdown-menu");
            item.Children.Each(child =>
            {
                var childTag = new MenuItemTag(child);
                ul.Append(childTag);
            });
        }
开发者ID:synhershko,项目名称:FubuMVC.Bootstrap,代码行数:14,代码来源:MenuItemTag.cs

示例14: ChildNodes

        public static HtmlString ChildNodes(this IDocumentNode IDocumentNode, int atLevel = 0, bool includeHidden = false, bool includeDeleted = false)
        {
            var ul = new HtmlTags.HtmlTag("ul");
            ul.AddClass("topnavigation");

            foreach (var c in IDocumentNode.AncestorAtLevel(atLevel).Children.Where(n => (includeDeleted || !n.IsDeleted) && (includeHidden || !n.IsHidden)))
            {
                var li = new HtmlTags.HtmlTag("li");
                if (IDocumentNode.IsDescendantOrSameAs(c)) li.AddClass("selected");
                li.Add("a").Attr("href", c.Url).Text(c.Name);
                ul.Children.Add(li);
            }
            return new HtmlString(ul.ToHtmlString());
        }
开发者ID:Programenta,项目名称:NodeTreeCms,代码行数:14,代码来源:HtmlBuilder.cs

示例15: ChildNodesRecursiveHtmlTag

        public static HtmlTag ChildNodesRecursiveHtmlTag(this IDocumentNode currentNode, IDocumentNode IDocumentNode, int allExpandToLevel = 2, bool includeHidden = false, bool includeDeleted = false, string addAdminPath = "")
        {
            var ul = new HtmlTags.HtmlTag("ul");
            foreach (var c in IDocumentNode.Children.Where(n => (includeDeleted || !n.IsDeleted) && (includeHidden || !n.IsHidden)))
            {
                var li = new HtmlTags.HtmlTag("li");

                var path = addAdminPath + c.Url;

                li.Add("a").Attr("href", path).Text(c.Name);
                if (c == currentNode)
                {
                    li.AddClass("selected");
                }
                if (c.IsDescendantOrSameAs(currentNode)) li.AddClass("sel");
                if (c.Children.Count > 0 && (c.Level < allExpandToLevel || c.IsDescendantOrSameAs(currentNode) || currentNode.IsDescendantOrSameAs(c)))
                {
                    li.Children.Add(ChildNodesRecursiveHtmlTag(currentNode, c, allExpandToLevel, includeHidden, includeDeleted, addAdminPath));
                }
                ul.Children.Add(li);
            }
            return ul;
        }
开发者ID:Programenta,项目名称:NodeTreeCms,代码行数:23,代码来源:HtmlBuilder.cs


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