本文整理汇总了C#中HtmlTag.Attribute方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag.Attribute方法的具体用法?C# HtmlTag.Attribute怎么用?C# HtmlTag.Attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTag
的用法示例。
在下文中一共展示了HtmlTag.Attribute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HiddenInputTag
public IHtmlNode HiddenInputTag()
{
IHtmlNode input = new HtmlTag("input")
.Attributes(new { type = "text",
style="display:none" });
if (Component.Items.Any() && Component.SelectedIndex != -1)
{
input.Attribute("value", Component.Items[Component.SelectedIndex].Value);
}
if (Component.Name.HasValue()) {
input.Attributes(new { name = Component.Name,
id = Component.Id + "-value" });
string value = Component.ViewContext.Controller.ValueOf<string>(Component.Name);
if (value.HasValue())
{
input.Attribute("value", value);
}
}
return input;
}
示例2: Build
public IHtmlNode Build()
{
IHtmlNode input = new HtmlTag("input")
.Attributes(new
{
title = Component.Name,
id = Component.Id,
autocomplete = "off",
name = Component.Name
})
.Attributes(Component.HtmlAttributes)
.PrependClass(UIPrimitives.Widget, "t-autocomplete", UIPrimitives.Input);
string value = Component.ViewContext.Controller.ValueOf<string>(Component.Name);
if (value.HasValue())
input.Attribute("value", value);
return input;
}
示例3: HiddenInputTag
public IHtmlNode HiddenInputTag()
{
IHtmlNode input = new HtmlTag("input")
.Attributes(new
{
type = "text",
style = "display:none"
});
if (Component.Name.HasValue())
input.Attributes(new
{
name = Component.Name,
id = Component.Id + "-value"
});
if(Component.Items.Any())
input.Attribute("value", Component.Items[Component.SelectedIndex].Value);
return input;
}
示例4: InnerContentTag
public IHtmlNode InnerContentTag()
{
IHtmlNode root = new HtmlTag("div").AddClass("t-dropdown-wrap t-state-default");
IHtmlNode input = new HtmlTag("input")
.Attributes(new { type = "text",
title = Component.Id })
.Attributes(Component.InputHtmlAttributes)
.PrependClass(UIPrimitives.Input)
.AppendTo(root);
if(Component.Items.Any() && Component.SelectedIndex != -1)
{
input.Attribute("value", Component.Items[Component.SelectedIndex].Text);
}
if (Component.Id.HasValue())
{
input.Attributes(new
{
id = Component.Id + "-input",
name = Component.Name + "-input"
});
string value = Component.ViewContext.Controller.ValueOf<string>(Component.Name + "-input");
if (value.HasValue())
{
input.Attribute("value", value);
}
}
IHtmlNode link = new HtmlTag("span").AddClass("t-select", UIPrimitives.Header);
new HtmlTag("span").AddClass(UIPrimitives.Icon, "t-arrow-down").Html("select").AppendTo(link);
link.AppendTo(root);
return root;
}
示例5: HeaderCellTag
public IHtmlNode HeaderCellTag(string dayOfWeek)
{
IHtmlNode cell = new HtmlTag("th")
.Attributes(new { scope = "col", title = dayOfWeek})
.Text(dayOfWeek.Substring(0, 1));
if (dayOfWeek.Length > 3)
cell.Attribute("abbr", dayOfWeek.Substring(0, 3));
return cell;
}