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


C# HtmlTag.ToHtmlString方法代码示例

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


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

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

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

示例3: AdminTree

        public static HtmlString AdminTree(IDocumentNode Model, string adminUrl, string divClassName = "")
        {
            var div = new HtmlTag("div");
            if (divClassName != "") div.AddClass(divClassName);

            var p = new HtmlTag("p").Append(new HtmlTag("a").Text("Root node").Attr("href", adminUrl));
            var tree = HtmlBuilder.ChildNodesRecursiveHtmlTag(Model, Model.AncestorAtLevel(0), 99, true, false, adminUrl);

            var pInfo = new HtmlTag("p").Text("Add new child");

            var form = new HtmlTag("form").Attr("method", "post").Attr("action", "#");

            form.Append(new HtmlTag("label").Attr("for", "new-name").Text("Header (name)"));
            form.Append(new HtmlTag("input").Id("new-name").Attr("name", "new-name").Attr("type", "text"));
            form.Append(new HtmlTag("input").Attr("type", "submit").Attr("name", "insert-new").Attr("value", "Add"));

            div.Append(p).Append(tree).Append(pInfo).Append(form);

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

示例4: Execute

        public string Execute(GetFlashes input)
        {
            /*
                <div class="alert">
                  <a class="close" data-dismiss="alert">×</a>
                  <strong>Warning!</strong> Best check yo self, you're not looking too good.
                </div>
             */

            var array = _flash.Retrieve<string[]>();
            if (array == null) return new NoTag().ToHtmlString();

            var div = new HtmlTag("div").AddClass("alert");
            var closeLink = new HtmlTag("a").AddClass("close").Data("dismiss", "alert");
            div.Append(closeLink);

            var ul = new HtmlTag("ul");

            array.Each(i => ul.Append("li", l => l.Text(i)));

            div.Append(ul);
            return div.ToHtmlString();
        }
开发者ID:randrews,项目名称:dovetail,代码行数:23,代码来源:get_handler.cs

示例5: Main

        static void Main(string[] args)
        {
            var arguments = new Arguments(args);
            var input = arguments["input"];
            var output = arguments["output"];

            var results = File.ReadAllText(input);
            var visits = ParseVisits(results);

            var failureTag = CreateFailureTag(visits);
            var statsTag = CreateStatsTag(visits);

            var html = new HtmlTag("html")
                .Append(new HtmlTag("head")
                            .Append(new HtmlTag("title").Text("JMeter Load Test Report")))
                .Append(new HtmlTag("body")
                            .Append(new HtmlTag("h1").Text("JMeter Load Test Report - " + DateTime.Now.ToString()))
                            .Append(failureTag)
                            .Append(statsTag));

            File.WriteAllText(output, html.ToHtmlString());
        }
开发者ID:dineshkummarc,项目名称:Session--1--Load-Testing-with-JMeter,代码行数:22,代码来源:Program.cs


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