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


C# HtmlTag.ToString方法代码示例

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


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

示例1: mustache_text

        public void mustache_text()
        {
            var tag = new HtmlTag("span");
            tag.MustacheText("prop");

            tag.ToString().ShouldEqual("<span>{{prop}}</span>");
        }
开发者ID:kharlamov,项目名称:FubuMVC.Core.UI,代码行数:7,代码来源:HtmlTagExtensionsTester.cs

示例2: AwesomeDisplay

        public static string AwesomeDisplay(this IFubuPage page, object model)
        {
            var type = model.GetType();
            var result = new StringBuilder();
            var tags = page.Tags(model);
            var sl = page.Get<IServiceLocator>();

            tags.SetProfile(AwesomeConfiguration.TagProfile);
            var tr = new HtmlTag("tr");
            foreach (var prop in getProperties(type))
            {

                var p = new SingleProperty(prop, type);
                var elementRequest = new ElementRequest(model, p, sl);
                var accessRight = page.Get<IFieldAccessService>().RightsFor(elementRequest);

                HtmlTag display = tags.DisplayFor(elementRequest).Authorized(accessRight.Read);
                var td = new HtmlTag("td").Append(display);
                tr.Append(td);

            }
            var editLink = new LinkTag("Edit", page.EditUrlFor(model));
            tr.Append(new HtmlTag("td").Append(editLink));
            var deleteLink = new LinkTag("Delete", page.DeleteUrlFor(model));
            tr.Append(new HtmlTag("td").Append(deleteLink));
            result.Append(tr.ToString());

            return result.ToString();
        }
开发者ID:rauhryan,项目名称:awesomesauce,代码行数:29,代码来源:AwesomeFubuPageExtensions.cs

示例3: mustache_attr

        public void mustache_attr()
        {
            var tag = new HtmlTag("a");
            tag.MustacheAttr("href", "url");

            tag.ToString().ShouldEqual("<a href=\"{{url}}\"></a>");
        }
开发者ID:kharlamov,项目名称:FubuMVC.Core.UI,代码行数:7,代码来源:HtmlTagExtensionsTester.cs

示例4: GetCharisma_Alert

 public static string GetCharisma_Alert(Charisma_AlertType type, string title, string msg)
 {
     var tag = new HtmlTag("div").AddClass("alert").AddClass(type.ToText());
     tag.Add("button").AddClass("close").Attr("type", "button").Attr("data-dismiss", "alert").Text("×");
     tag.Add("h4").AddClass("alert-heading").Text(title);
     tag.Add("p").Text(msg);
     return tag.ToString();
 }
开发者ID:vvvsrx,项目名称:AUserCenter,代码行数:8,代码来源:HtmlUtils.cs

示例5: SendConfirmationEmail

 private void SendConfirmationEmail(User user)
 {
     var email = new HtmlTag("body")
         .Child(new HtmlTag("h3").Text("Thank you for registering"))
         .Child(new HtmlTag("div").Id("wrapper")
                    .Child(new LinkTag("Click here to activate your account",
                                       UrlContext.ToFull(_urlRegistry.UrlFor(new ActivateAccountModel() {Id = user.Id})))));
     _emailService.SendEmail(user.Email, _emailSettings.DefaultFromEmailAddress, "Activate your account", email.ToString());
 }
开发者ID:rauhryan,项目名称:kokugen,代码行数:9,代码来源:IRegistrationService.cs

示例6: Should_build_tag_modifier

            public void Should_build_tag_modifier()
            {
                var registry = new TestConventionRegistry();

                registry.TagModifiers.Count().ShouldEqual(3);

                var htmlTag = new HtmlTag("a");
                registry.TagModifiers.ToList()[2].Modify(new UIComponentContext(_boolExpr.ToAccessor(), new TestModel(), null), htmlTag);
                htmlTag.ToString().ShouldEqual(new HtmlTag("a").AddClass("test").ToString());
            }
开发者ID:marcusswope,项目名称:MVCConventions,代码行数:10,代码来源:ConventionRegistrySpecs.cs

示例7: Transform

        public string Transform(Topic current, string data)
        {
            var parts = data.Split(';');
            var url = _urls.ToUrl(current, parts.First());



            var image = new HtmlTag("img").Attr("src", url).Style("max-width", "100%");

            if (parts.Length == 0)
            {
                return image.ToString();
            }

            var header = new HtmlTag("h5", x =>
            {
                x.Add("strong").Text(parts.Last());
            });

            return header.ToString() + image.ToString();

        }
开发者ID:jamesmanning,项目名称:Storyteller,代码行数:22,代码来源:ImageTransformHandler.cs

示例8: Transform

        public string Transform(Topic current, string data)
        {
            var ol = new HtmlTag("ol").AddClass("breadcrumb");

            current.Ancestors().Each(x =>
            {
                ol.Add("li/a").Attr("href", _resolver.ToUrl(current, x)).Text(x.Title);
            });

            ol.Add("li").AddClass("active").Text(current.Title);

            return ol.ToString();
        }
开发者ID:jamesmanning,项目名称:Storyteller,代码行数:13,代码来源:ParentBreadcrumbsTransformHandler.cs

示例9: wrap_body

        public void wrap_body()
        {
            var layout = new DefinitionListLabelAndField();
            var display = new TextboxTag().Attr("value", "something");
            layout.BodyTag = display;

            var wrapper = new HtmlTag("strong");
            layout.WrapBody(wrapper);

            layout.BodyTag.ShouldBeTheSameAs(display);
            wrapper.Children.ShouldHaveTheSameElementsAs(display);

            layout.ToString().ShouldContain(wrapper.ToString());
        }
开发者ID:paulbatum,项目名称:fubumvc,代码行数:14,代码来源:DefinitionListLabelAndFieldTester.cs

示例10: write_to_string

        public void write_to_string()
        {
            var layout = new DefinitionListLabelAndField();
            var label = new HtmlTag("span").Text("some text");
            layout.LabelTag = label;

            var display = new TextboxTag().Attr("value", "something");
            layout.BodyTag = display;

            var html = layout.ToString();

            html.ShouldContain(label.ToString());
            html.ShouldContain(display.ToString());
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:14,代码来源:DefinitionListLabelAndFieldTester.cs

示例11: GenerateHtml

        public string GenerateHtml(Topic topic)
        {
            var html = _generator.Generate(topic);

            var builder = new StringBuilder(html);
            topic.Substitutions.Each((key, value) => { builder.Replace(key, value); });

            var script = _webSocketScript.Replace("%WEB_SOCKET_ADDRESS%", _settings.WebsocketAddress);
            builder.Replace("</head>", script + "\n</head>");

            var tag = new HtmlTag("script").Attr("language", "javascript").Attr("src", "/topics.js");
            builder.Replace("</head>", tag.ToString() + "\n</head>");

            return builder.ToString();
        }
开发者ID:rlloyd2001,项目名称:Storyteller,代码行数:15,代码来源:TopicMiddleware.cs

示例12: get_collapsible_partial

        // SAMPLE: UsingCollapsibleTag
        public CollapsiblePartialViewModel get_collapsible_partial()
        {
            var inner = new HtmlTag("div");
            for (var i = 0; i < 5; i++ )
            {
                inner.Add("p").Text(Guid.NewGuid().ToString());
            }


            var tag = new CollapsibleTag("acc1", "This is the collapsible tag");
            tag.AppendContent(inner.ToString());

            return new CollapsiblePartialViewModel{
                Tag = tag
            };
        }
开发者ID:mtscout6,项目名称:FubuMVC.TwitterBootstrap,代码行数:17,代码来源:CollapsiblePartialEndpoint.cs

示例13: Transform

        public string Transform(Topic current, string data)
        {
            var props = data.Split(';');
            var key = props.First();

            

            try
            {
                var other = findOther(current, key);
                if (other == null) return string.Empty;

                return transformFromTopic(current, other, props);
            }
            catch (ArgumentOutOfRangeException)
            {
                var tag = new HtmlTag("p").AddClass("bg-warning").Style("padding", "5px");
                tag.Add("b").Text("Unknown topic key '{0}'".ToFormat(key));
                tag.Add("small").Text(" -- CTRL+SHIFT+R to force refresh the topic tree");
                return tag.ToString();
            }
        }
开发者ID:jamesmanning,项目名称:Storyteller,代码行数:22,代码来源:LinkToTransformHandler.cs

示例14: UserStatusesToSpan

        public static Nancy.ViewEngines.Razor.IHtmlString UserStatusesToSpan(UserAccountStatuses status)
        {
            var tag = new HtmlTag("span").AddClass("label");

            switch (status)
            {
                case UserAccountStatuses.ApprovalPending:
                    tag.Text(UserAccountStatuses.ApprovalPending.ToText());
                    break;
                case UserAccountStatuses.Approved:
                    tag.AddClass("label-success").Text(UserAccountStatuses.Approved.ToText());
                    break;
                case UserAccountStatuses.Banned:
                    tag.AddClass("label-important").Text(UserAccountStatuses.Banned.ToText());
                    break;
                case UserAccountStatuses.Disapproved:
                    tag.AddClass("label-warning").Text(UserAccountStatuses.Disapproved.ToText());
                    break;
                case UserAccountStatuses.NotActive:
                    tag.AddClass("label-inverse").Text(UserAccountStatuses.NotActive.ToText());
                    break;
                default:
                    tag.AddClass("label-info").Text("未知");
                    break;
            }
            return new NonEncodedHtmlString(tag.ToString());
        }
开发者ID:vvvsrx,项目名称:AUserCenter,代码行数:27,代码来源:HtmlUtils.cs

示例15: VisitTableCell

        private static void VisitTableCell(HtmlTag cell, ExportRow exportRow)
        {
            var tag = cell.TagName().ToLower();
            if (tag != HtmlTagConstants.Td && tag != HtmlTagConstants.Th )
            {
                cell.Children.ForEach(c => VisitTableCell(c, exportRow));
                return;
            }
            var isImage = cell.Children.Any(c => c.TagName().ToLower() == HtmlTagConstants.Img);
            var text = cell.Children.Any() ? cell.ToString() : cell.Text();
            var exportCell = new ExportCell
                             	{
                                    Text =  ExportFromTable.HtmlTagRegex.Replace(text ?? string.Empty, string.Empty),
                                    Markup = isImage ? cell.FirstChild().ToString():string.Empty
                                };

            SetColspan(cell, exportCell);
            exportRow.AddCell(exportCell);
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:19,代码来源:HtmlTagToExportVisitor.cs


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