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


C# HtmlTag.Text方法代码示例

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


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

示例1: RateSystemStatus

        public static HtmlTag RateSystemStatus(this HtmlHelper helper, DateTime startDate, DateTime endDate)
        {
            if (startDate == null)
            {
                throw new ArgumentNullException("Start date can not be null");
            }

            if (endDate == null)
            {
                throw new ArgumentNullException("End date can not be null");
            }

            HtmlTag status = new HtmlTag("span");

            if (startDate <= DateTime.Now && DateTime.Now <= endDate)
            {
                status.Text("Active").AddClass("btn btn-success btn-xs");
            }
            else if (startDate > DateTime.Now)
            {
                status.Text("Upcoming").AddClass("btn btn-warning btn-xs");
            }
            else if (endDate < DateTime.Now)
            {
                status.Text("Past").AddClass("btn btn-danger btn-xs");
            }

            return status;
        }
开发者ID:chunk1ty,项目名称:VoteSystem,代码行数:29,代码来源:CustomHtmlHelpers.cs

示例2: 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

示例3: WriteBody

        public void WriteBody(BehaviorChain chain, HtmlTag row, HtmlTag cell)
        {
            Type inputType = chain.ActionInputType();

            if (inputType == null)
            {
                cell.Text(" -");
            }
            else
            {
                cell.Text(inputType.Name).Title(inputType.AssemblyQualifiedName);
            }
        }
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:13,代码来源:InputModelColumn.cs

示例4: 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

示例5: ScriptTag

        public ScriptTag(string mode, Func<string, string> toFullUrl, Asset asset, string defaultUrl = null)
            : base("script")
        {
            // http://stackoverflow.com/a/1288319/75194 
            Attr("type", "text/javascript");

            if (asset == null)
            {
                Attr("src", toFullUrl(defaultUrl));
                return;
            }

            if (asset.CdnUrl.IsNotEmpty())
            {
                Attr("src", asset.CdnUrl);
                if (asset.FallbackTest.IsNotEmpty() && asset.File != null)
                {
                    Next = new HtmlTag("script");
                    var text = "if ({0}) document.write(unescape(\"%3Cscript src='{1}' type='text/javascript'%3E%3C/script%3E\"));".ToFormat(asset.FallbackTest, asset.Url);

                    Next.Encoded(false);
                    Next.Text(text);
                }

                return;
            }

            var url = asset.Url;
            if (mode.InDevelopment() && asset.File != null)
            {
                url += "?Etag=" + asset.File.Etag();
            }

            Attr("src", toFullUrl(url));
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:35,代码来源:ScriptTag.cs

示例6: 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

示例7: ToHtmlTag

 public HtmlTag ToHtmlTag()
 {
     var root = new HtmlTag("Button");
     root.Text(_text);
     addMainTagAttributes();
     addClassesAndAttributesToRoot(root);
     return root;
 }
开发者ID:reharik,项目名称:CannibalCoder,代码行数:8,代码来源:StandardButtonExpression.cs

示例8: AssertOption

 private void AssertOption(
     HtmlTag option,
     string display, 
     object value)
 {
     Assert.Equal("option", option.TagName());
     Assert.Equal(display, option.Text());
     Assert.True(option.ValueIsEqual(value));
 }
开发者ID:matutee,项目名称:Bardock.Utils,代码行数:9,代码来源:GroupedSelectTagTest.cs

示例9: write_body_for_chain_with_no_input_type

        public void write_body_for_chain_with_no_input_type()
        {
            var chain = new BehaviorChain();
            var tag = new HtmlTag("td");

            new InputModelColumn().WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(" -");
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:9,代码来源:InputModelColumnTester.cs

示例10: 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

示例11: write_route_column_when_the_route_does_not_exist

        public void write_route_column_when_the_route_does_not_exist()
        {
            var chain = new BehaviorChain();

            var tag = new HtmlTag("td");

            new RouteColumn(new StubCurrentHttpRequest("http://server")).WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(" -");
        }
开发者ID:jmarnold,项目名称:fubumvc,代码行数:10,代码来源:RouteColumnTester.cs

示例12: write_with_no_outputs

        public void write_with_no_outputs()
        {
            var chain = new BehaviorChain();
            var tag = new HtmlTag("td");

            var column = new OutputColumn();
            column.WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(" -");
        }
开发者ID:henninga,项目名称:fubumvc,代码行数:10,代码来源:OutputColumnTester.cs

示例13: VisualizePartial

        public HtmlTag VisualizePartial(TypeInput input)
        {
            var type = input.Type;

            var div = new HtmlTag("div");
            div.Text(type.Name);
            div.Title(type.AssemblyQualifiedName);

            return div;
        }
开发者ID:cothienlac86,项目名称:fubumvc,代码行数:10,代码来源:TypeFubuDiagnostics.cs

示例14: write_route_column_when_the_route_does_not_exist

        public void write_route_column_when_the_route_does_not_exist()
        {
            var chain = new BehaviorChain();

            var tag = new HtmlTag("td");

            new RouteColumn().WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(" -");
        }
开发者ID:henninga,项目名称:fubumvc,代码行数:10,代码来源:RouteColumnTester.cs

示例15: write_body_for_chain_with_input_type

        public void write_body_for_chain_with_input_type()
        {
            var chain = new BehaviorChain();
            chain.AddToEnd(ActionCall.For<ControllerTarget>(x => x.OneInOneOut(null)));
            var tag = new HtmlTag("td");

            new InputModelColumn().WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(typeof (Model1).Name);
            tag.Title().ShouldEqual(typeof (Model1).AssemblyQualifiedName);
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:11,代码来源:InputModelColumnTester.cs


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