本文整理汇总了C#中HtmlTag.Append方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag.Append方法的具体用法?C# HtmlTag.Append怎么用?C# HtmlTag.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTag
的用法示例。
在下文中一共展示了HtmlTag.Append方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: append_all_tags_from_a_sequence
public void append_all_tags_from_a_sequence()
{
var sequence = new[] { new HtmlTag("br"), new HtmlTag("hr") };
var parent = new HtmlTag("div");
parent.Append(sequence);
parent.ToString().ShouldEqual("<div><br></br><hr /></div>");
}
示例2: Build
public override HtmlTag Build(ElementRequest request)
{
HtmlTag root = new HtmlTag("div").Attr("data-bind", "foreach: "+ CCHtmlConventionsKO.DeriveElementName(request));
var child = new HtmlTag("div").Attr("data-bind", "text: $data" );
root.Append(child);
return root;
}
示例3: append_adds_a_new_child_and_return_the_original
public void append_adds_a_new_child_and_return_the_original()
{
var parent = new HtmlTag("div");
var resultOfAppend = parent.Append("p");
resultOfAppend.ShouldBeTheSameAs(parent);
parent.ToString().ShouldEqual("<div><p></p></div>");
}
示例4: Build
public override HtmlTag Build(ElementRequest request)
{
HtmlTag root = new HtmlTag("a");
root.Attr("href", "mailto:" + request.StringValue());
root.Attr("name", request.Accessor.FieldName + "Link");
root.Append(new HtmlTag("span").Text(request.StringValue()));
return root;
}
示例5: MakeRadioButton
private static HtmlTag MakeRadioButton(string display, object value, string name)
{
DivTag divTag = new DivTag(display);
HtmlTag radioButton = new RadioButtonTag(false).Attr("value", value).Attr("name",name);
HtmlTag label = new HtmlTag("label").Text(display);
label.Append(radioButton);
divTag.Append(label);
return divTag;
}
示例6: ButtonGroup
public static HtmlTag ButtonGroup(this IHtmlHelper helper,
params HtmlTag[] buttons)
{
var outer = new HtmlTag("div").AddClass("form-group");
var inner = new HtmlTag("div")
.AddClasses("col-md-offset-2", "col-md-10")
.Append(buttons);
return outer.Append(inner);
}
示例7: Build
public override HtmlTag Build(ElementRequest request)
{
HtmlTag root = new HtmlTag("a");
root.Attr("href", request.RawValue);
root.Attr("target", "_blank");
root.Id(request.Accessor.FieldName);
var img = new HtmlTag("img");
img.Attr("src", request.RawValue);
root.Append(img);
return root;
}
示例8: X
public void X()
{
var wrapper = new HtmlTag("div");
var tag = new HtmlTag("input").NoClosingTag();
wrapper.Append(tag);
wrapper.ToString()
.ShouldEqual("<div><input /></div>");
// actually renders "<div><input />")
}
示例9: append_all_tags_from_a_tag_source
public void append_all_tags_from_a_tag_source()
{
var tagSource = new TagList(new[]{new HtmlTag("br"), new HtmlTag("hr") });
var parent = new HtmlTag("div");
parent.Append(tagSource);
parent.ToString().ShouldEqual("<div><br></br><hr /></div>");
}
示例10: insert_a_new_child_tag_as_the_first_child
public void insert_a_new_child_tag_as_the_first_child()
{
var tag = new HtmlTag("div");
tag.Append("span");
tag.InsertFirst(new HtmlTag("p"));
tag.ToString().ShouldEqual("<div><p></p><span></span></div>");
}
示例11: append_nested_children
public void append_nested_children()
{
var parent = new HtmlTag("div");
parent.Append("p > span");
parent.ToString().ShouldEqual("<div><p><span></span></p></div>");
}
示例12: tag_with_NoClosingTag_should_be_wrapped_correctly_with_tag_with_closingTag
public void tag_with_NoClosingTag_should_be_wrapped_correctly_with_tag_with_closingTag()
{
var wrapper = new HtmlTag("div");
var tag = new HtmlTag("input").NoClosingTag();
wrapper.Append(tag);
wrapper.ToString().ShouldEqual("<div><input /></div>");
}
示例13: can_control_br_tag_behavior_even_if_using_regular_html_tag
public void can_control_br_tag_behavior_even_if_using_regular_html_tag()
{
BrTag.ComplianceMode = BrTag.ComplianceModes.Xhtml;
var tagSource = new TagList(new[] { new HtmlTag("br"), new HtmlTag("hr") });
var parent = new HtmlTag("div");
parent.Append(tagSource);
parent.ToString().ShouldEqual("<div><br /><hr /></div>");
}