本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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();
}
示例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());
}