本文整理汇总了C#中HtmlTags.HtmlTag.Text方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag.Text方法的具体用法?C# HtmlTag.Text怎么用?C# HtmlTag.Text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTags.HtmlTag
的用法示例。
在下文中一共展示了HtmlTag.Text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RateSystemStatus
public static HtmlTag RateSystemStatus(this HtmlHelper helper, DateTime startDate, DateTime endDate)
{
if (startDate == null)
{
throw new ArgumentNullException("Start date can not be null");
}
if (endDate == null)
{
throw new ArgumentNullException("End date can not be null");
}
HtmlTag status = new HtmlTag("span");
if (startDate <= DateTime.Now && DateTime.Now <= endDate)
{
status.Text("Active").AddClass("btn btn-success btn-xs");
}
else if (startDate > DateTime.Now)
{
status.Text("Upcoming").AddClass("btn btn-warning btn-xs");
}
else if (endDate < DateTime.Now)
{
status.Text("Past").AddClass("btn btn-danger btn-xs");
}
return status;
}
示例2: BuildLabel
//this is hideous but wanted to show an idea.
public HtmlTag BuildLabel(BehaviorNode behaviorNode)
{
// TODO -- come back and policize this
var span = new HtmlTag("span").AddClass("label");
var pp = behaviorNode.GetType().PrettyPrint();
span.Text("behavior");
if (pp.StartsWith("WebForm"))
{
span.Text("View");
span.AddClass("notice");
}
else if (pp.StartsWith("Call"))
{
span.AddClass("warning");
span.Text("continuation");
}
else if (!behaviorNode.GetType().Name.StartsWith("Fubu"))
{
span.Text("fubu");
}
return span;
}
示例3: WriteBody
public void WriteBody(BehaviorChain chain, HtmlTag row, HtmlTag cell)
{
Type inputType = chain.ActionInputType();
if (inputType == null)
{
cell.Text(" -");
}
else
{
cell.Text(inputType.Name).Title(inputType.AssemblyQualifiedName);
}
}
示例4: WriteResults
public void WriteResults(Counts counts)
{
var countsTag = new HtmlTag("div").AddClass("results");
if (counts.WasSuccessful())
{
countsTag.Text("Succeeded with " + counts.ToString());
countsTag.AddClass("results-" + HtmlClasses.PASS);
}
else
{
countsTag.Text("Failed with " + counts.ToString());
countsTag.AddClass("results-" + HtmlClasses.FAIL);
}
_suiteName.Next = countsTag;
}
示例5: ScriptTag
public ScriptTag(string mode, Func<string, string> toFullUrl, Asset asset, string defaultUrl = null)
: base("script")
{
// http://stackoverflow.com/a/1288319/75194
Attr("type", "text/javascript");
if (asset == null)
{
Attr("src", toFullUrl(defaultUrl));
return;
}
if (asset.CdnUrl.IsNotEmpty())
{
Attr("src", asset.CdnUrl);
if (asset.FallbackTest.IsNotEmpty() && asset.File != null)
{
Next = new HtmlTag("script");
var text = "if ({0}) document.write(unescape(\"%3Cscript src='{1}' type='text/javascript'%3E%3C/script%3E\"));".ToFormat(asset.FallbackTest, asset.Url);
Next.Encoded(false);
Next.Text(text);
}
return;
}
var url = asset.Url;
if (mode.InDevelopment() && asset.File != null)
{
url += "?Etag=" + asset.File.Etag();
}
Attr("src", toFullUrl(url));
}
示例6: Menu
public static HtmlTag Menu(this IFubuPage page, string menuName = null)
{
var navigationService = page.Get<INavigationService>();
var securityContext = page.Get<ISecurityContext>();
var items = navigationService.MenuFor(new NavigationKey(menuName ?? StringConstants.BlogName));
var menu = new HtmlTag("ul");
items.Each(x =>
{
var link = new LinkTag(x.Key, x.Url);
var li = new HtmlTag("li");
if (x.Key.Equals("Logout") && x.MenuItemState == MenuItemState.Available)
{
var spanTag = new HtmlTag("span");
spanTag.Text(string.Format("Welcome, {0}", securityContext.CurrentIdentity.Name));
menu.Append(spanTag);
}
if (x.MenuItemState == MenuItemState.Active)
li.AddClass("current");
if(x.MenuItemState == MenuItemState.Active || x.MenuItemState == MenuItemState.Available)
menu.Append(li.Append(link));
});
return menu;
}
示例7: ToHtmlTag
public HtmlTag ToHtmlTag()
{
var root = new HtmlTag("Button");
root.Text(_text);
addMainTagAttributes();
addClassesAndAttributesToRoot(root);
return root;
}
示例8: AssertOption
private void AssertOption(
HtmlTag option,
string display,
object value)
{
Assert.Equal("option", option.TagName());
Assert.Equal(display, option.Text());
Assert.True(option.ValueIsEqual(value));
}
示例9: write_body_for_chain_with_no_input_type
public void write_body_for_chain_with_no_input_type()
{
var chain = new BehaviorChain();
var tag = new HtmlTag("td");
new InputModelColumn().WriteBody(chain, null, tag);
tag.Text().ShouldEqual(" -");
}
示例10: InputConventions
public InputConventions()
{
Editors.Always
.Modify((request, tag) => tag.Attr("id", request.Accessor.Name));
Editors
.If(x => x.Accessor.FieldName.Contains("Password") && x.Accessor.PropertyType.IsString())
.Attr("type", "password");
Editors
.If(x => x.Accessor.FieldName.Contains("Email") && x.Accessor.PropertyType.IsString())
.Attr("type", "email");
Editors
.If(x => x.Accessor.FieldName.Contains("Body") && x.Accessor.PropertyType.IsString())
.Modify((r, x) =>
{
x.TagName("textarea");
x.Text(r.StringValue());
});
Editors
.If(x => x.Accessor.InnerProperty.HasAttribute<RequiredAttribute>())
.Modify(x => x.AddClass("required"));
Editors
.If(x => x.Accessor.InnerProperty.HasAttribute<MinLengthAttribute>())
.Modify((request, tag) =>
{
var length = request.Accessor.InnerProperty.GetAttribute<MinLengthAttribute>().Length;
tag.Attr("minlength", length);
});
Editors
.If(x => x.Accessor.InnerProperty.HasAttribute<MaxLengthAttribute>())
.Modify((request, tag) =>
{
var length = request.Accessor.InnerProperty.GetAttribute<MaxLengthAttribute>().Length;
tag.Attr("maxlength", length);
});
Editors.Always
.Modify((request, tag) =>
{
var result = request.Get<IFubuRequest>().Get<ValidationResult>();
if (result == null || result.IsValid) return;
var error = result.Errors.FirstOrDefault(x => x.PropertyName == request.Accessor.InnerProperty.Name);
if (error == null) return;
var errorLabel = new HtmlTag("label");
errorLabel.Text(error.ErrorMessage);
errorLabel.AddClass("error");
errorLabel.Attr("for", request.Accessor.InnerProperty.Name);
errorLabel.Attr("generated", "true");
tag.Next = errorLabel;
});
}
示例11: write_route_column_when_the_route_does_not_exist
public void write_route_column_when_the_route_does_not_exist()
{
var chain = new BehaviorChain();
var tag = new HtmlTag("td");
new RouteColumn(new StubCurrentHttpRequest("http://server")).WriteBody(chain, null, tag);
tag.Text().ShouldEqual(" -");
}
示例12: write_with_no_outputs
public void write_with_no_outputs()
{
var chain = new BehaviorChain();
var tag = new HtmlTag("td");
var column = new OutputColumn();
column.WriteBody(chain, null, tag);
tag.Text().ShouldEqual(" -");
}
示例13: VisualizePartial
public HtmlTag VisualizePartial(TypeInput input)
{
var type = input.Type;
var div = new HtmlTag("div");
div.Text(type.Name);
div.Title(type.AssemblyQualifiedName);
return div;
}
示例14: write_route_column_when_the_route_does_not_exist
public void write_route_column_when_the_route_does_not_exist()
{
var chain = new BehaviorChain();
var tag = new HtmlTag("td");
new RouteColumn().WriteBody(chain, null, tag);
tag.Text().ShouldEqual(" -");
}
示例15: write_body_for_chain_with_input_type
public void write_body_for_chain_with_input_type()
{
var chain = new BehaviorChain();
chain.AddToEnd(ActionCall.For<ControllerTarget>(x => x.OneInOneOut(null)));
var tag = new HtmlTag("td");
new InputModelColumn().WriteBody(chain, null, tag);
tag.Text().ShouldEqual(typeof (Model1).Name);
tag.Title().ShouldEqual(typeof (Model1).AssemblyQualifiedName);
}