本文整理汇总了C#中HtmlTag类的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag类的具体用法?C# HtmlTag怎么用?C# HtmlTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlTag类属于命名空间,在下文中一共展示了HtmlTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: TableTag
public TableTag()
: base("table")
{
_header = new HtmlTag("thead", this);
_footer = new HtmlTag("tfoot", this).Render(false);
_body = new HtmlTag("tbody", this);
}
示例3: CssBoxFrame
/// <summary>
/// Init.
/// </summary>
/// <param name="parent">the parent box of this box</param>
/// <param name="tag">the html tag data of this box</param>
public CssBoxFrame(CssBox parent, HtmlTag tag)
: base(parent, tag)
{
_imageWord = new CssRectImage(this);
Words.Add(_imageWord);
Uri uri;
if (Uri.TryCreate(GetAttribute("src"),UriKind.Absolute, out uri))
{
if(uri.Host.IndexOf("youtube.com",StringComparison.InvariantCultureIgnoreCase) > -1)
{
_isVideo = true;
LoadYoutubeDataAsync(uri);
}
else if (uri.Host.IndexOf("vimeo.com",StringComparison.InvariantCultureIgnoreCase) > -1)
{
_isVideo = true;
LoadVimeoDataAsync(uri);
}
}
if (!_isVideo)
{
SetErrorBorder();
}
}
示例4: CustomUIAttribute
public CustomUIAttribute(int fieldOrder, int fieldLength, HtmlTag tag, string fieldDisplayName)
{
_FieldOrder = fieldOrder;
_FieldLength = fieldLength;
_Tag = tag;
_FieldDisplayName = fieldDisplayName;
}
示例5: parent_property_is_set_correctly_using_append
public void parent_property_is_set_correctly_using_append()
{
var child = new HtmlTag("span");
var tag = new HtmlTag("div").Append(child);
tag.ShouldEqual(child.Parent);
tag.Children[0].ShouldEqual(child);
}
示例6: ApplyTo
public void ApplyTo(IHtmlNode target)
{
var filtered = column.Grid.DataProcessor.FilterDescriptors.SelectRecursive(filter =>
{
CompositeFilterDescriptor compositeDescriptor = filter as CompositeFilterDescriptor;
if (compositeDescriptor != null)
{
return compositeDescriptor.FilterDescriptors;
}
return null;
})
.Where(filter => filter is FilterDescriptor)
.OfType<FilterDescriptor>()
.Any(filter => filter.Member.IsCaseInsensitiveEqual(column.Member));
var wrapper = new HtmlTag("div")
.AddClass("t-grid-filter", "t-state-default")
.ToggleClass("t-active-filter", filtered);
wrapper.AppendTo(target);
var icon = new HtmlTag("span").AddClass("t-icon", "t-filter");
icon.AppendTo(wrapper);
}
示例7: Build
public override void Build(ElementRequest request, HtmlTag tag)
{
// todo can we narrow down for numbers that it's a whole number (probably need a regex to allow commas too)
tag.AllTags()
.Where(t => t.IsInputElement())
.ForEach(t => t.AddClass("number"));
}
示例8: HtmlListInfo
public HtmlListInfo(HtmlTag htmlTag, int columns = 0, object htmlAttributes = null, TextLayout textLayout = TextLayout.Default)
{
HtmlTag = htmlTag;
Columns = columns;
HtmlAttributes = htmlAttributes;
TextLayout = textLayout;
}
示例9: do_not_write_closing_tag
public void do_not_write_closing_tag()
{
var tag = new HtmlTag("span").Id("id");
tag.NoClosingTag();
tag.ToString().ShouldEqual("<span id=\"id\">");
}
示例10: add_returns_the_newly_created_child_tag
public void add_returns_the_newly_created_child_tag()
{
var original = new HtmlTag("div");
var child = original.Add("span");
child.ToString().ShouldEqual("<span></span>");
original.ToString().ShouldEqual("<div><span></span></div>");
}
示例11: 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>");
}
示例12: add_and_return_a_child_tag_by_type
public void add_and_return_a_child_tag_by_type()
{
var original = new HtmlTag("div");
var child = original.Add<HiddenTag>();
child.ToString().ShouldEqual("<input type=\"hidden\" />");
original.ToString().ShouldEqual("<div><input type=\"hidden\" /></div>");
}
示例13: AddElementName
public static void AddElementName(ElementRequest request, HtmlTag tag)
{
if (tag.IsInputElement())
{
tag.Attr("name", DeriveElementName(request));
}
}
示例14: CellTag
public IHtmlNode CellTag(DateTime day, string urlFormat, bool isOtherMonth)
{
IHtmlNode cell = new HtmlTag("td");
if (isOtherMonth)
{
cell.AddClass("t-other-month");
}
else if(Calendar.Value != null && day.Day == Calendar.Value.Value.Day)
{
cell.AddClass(UIPrimitives.SelectedState);
}
if (Calendar.IsDateInRange(day))
{
var href = GetUrl(day, urlFormat);
IHtmlNode link = new HtmlTag("a")
.AddClass(UIPrimitives.Link + (href != "#" ? " t-action-link" : string.Empty))
.Attribute("href", href)
.Text(day.Day.ToString());
cell.Children.Add(link);
}
else
{
cell.Html(" ");
}
return cell;
}
示例15: is_visible_set_to_true_by_default
public void is_visible_set_to_true_by_default()
{
var tag = new HtmlTag("div");
tag.Visible().ShouldBeTrue();
tag.ToString().ShouldEqual("<div></div>");
}