本文整理汇总了C#中HtmlTags.HtmlTag类的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag类的具体用法?C# HtmlTag怎么用?C# HtmlTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlTag类属于HtmlTags命名空间,在下文中一共展示了HtmlTag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Checkbox
private static HtmlTag Checkbox(UIComponentContext context)
{
var checkbox = new CheckboxTag(context.Value<bool>()).Attr("value", "true");
var hidden = new HtmlTag("input").Attr("type", "hidden").Attr("value", "false");
checkbox.Next = hidden;
return checkbox;
}
开发者ID:marcusswope,项目名称:MVCConventions,代码行数:7,代码来源:ExampleInputConventions.cs
示例2: AddElementName
public static void AddElementName(ElementRequest request, HtmlTag tag)
{
if (tag.IsInputElement())
{
tag.Attr("name", request.ElementId);
}
}
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:7,代码来源:DefaultHtmlConventions.cs
示例3: AuthButtons
public static MvcHtmlString AuthButtons(this HtmlHelper htmlHelper)
{
var authContainer =
new HtmlTag("div")
.Attr("style", "overflow: hidden;")
.Append("input",
ht => ht.Id("authType").Attr("name", "authType").Attr("type", "hidden").Attr("value", "1"))
.Append("a",
ht => ht
.Attr("href", "javascript:auth.signin('twitter')")
.AddClasses("simpleAuthButton", "twitter")
.Text("twitter"))
.Append("a",
ht => ht
.Attr("href", "javascript:auth.signin('facebook')")
.AddClasses("simpleAuthButton", "facebook")
.Text("facebook"))
.Append("a",
ht => ht
.Attr("href", "javascript:auth.signin('google')")
.AddClasses("simpleAuthButton", "google")
.Text("google"))
.ToHtmlString();
return new MvcHtmlString(authContainer);
}
开发者ID:smithkl42,项目名称:SimpleSocialAuth,代码行数:26,代码来源:HtmlExtensions.cs
示例4: TestEditorTag
public TestEditorTag(FixtureLibrary library)
: base("div")
{
AddClass("main");
Add("h2").AddClass(HtmlClasses.TEST_NAME);
Id("testEditor");
AddClass(HtmlClasses.TEST_EDITOR);
_container = Add("div").AddClasses("container", HtmlClasses.SECTION, "test-editor");
FixtureGraph fixture = library.BuildTopLevelGraph();
HtmlTag holder = new HolderTag(fixture).AddClass("top-level-holder");
holder.Children.Last().Render(false);
Container
.MetaData(GrammarConstants.LEAF_NAME, GrammarConstants.TEST)
.MetaData(GrammarConstants.FIXTURE, GrammarConstants.TEST)
.MetaData(GrammarConstants.SELECTION_MODE, SelectionMode.OneOrMore.ToString())
.Append(holder)
.Append(new HtmlTag("hr"));
Container.ActionLink(fixture.Policies.AddGrammarText, GrammarConstants.ADD_SECTION_ACTIVATOR);
Container.Append(new GrammarSelector(fixture).Build());
}
开发者ID:adymitruk,项目名称:storyteller,代码行数:26,代码来源:TestEditorTag.cs
示例5: mustache_attr
public void mustache_attr()
{
var tag = new HtmlTag("a");
tag.MustacheAttr("href", "url");
tag.ToString().ShouldEqual("<a href=\"{{url}}\"></a>");
}
开发者ID:kharlamov,项目名称:FubuMVC.Core.UI,代码行数:7,代码来源:HtmlTagExtensionsTester.cs
示例6: Build
public override HtmlTag Build(ElementRequest request)
{
HtmlTag root = new HtmlTag("div").Attr("data-bind", "foreach: "+ CCHtmlConventions2.DeriveElementName(request));
var child = new HtmlTag("div").Attr("data-bind", "text: $data" );
root.Append(child);
return root;
}
开发者ID:reharik,项目名称:CannibalCoder,代码行数:7,代码来源:ListDisplayBuilder2.cs
示例7: Modify
public virtual void Modify(HtmlTag form)
{
if (!_modify) return;
form.Data("validation-mode", _value.ToLower());
form.AddClass("validated-form");
}
开发者ID:emiaj,项目名称:fubuvalidation,代码行数:7,代码来源:ValidationMode.cs
示例8: RenderAuthWarnings
public static MvcHtmlString RenderAuthWarnings(this HtmlHelper htmlHelper)
{
var appSettingsKeys =
new[]
{
"googleAppID", "googleAppSecret",
"facebookAppID", "facebookAppSecret",
"twitterConsumerKey", "twitterConsumerSecret"
};
var noValueForSetting = appSettingsKeys
.Any(key => string.IsNullOrEmpty(ConfigurationManager.AppSettings[key]));
var message = "";
if (noValueForSetting)
{
message = new HtmlTag("p")
.Attr("style", "color: Red;")
.Text("Not all key and secrets are filled in a configuration file.")
.ToHtmlString();
}
return new MvcHtmlString(message);
}
开发者ID:smithkl42,项目名称:SimpleSocialAuth,代码行数:25,代码来源:HtmlExtensions.cs
示例9: Build
public override HtmlTag Build(ElementRequest request)
{
var tag = new HtmlTag("div").Text(request.StringValue()).AddClass("editable").Id(request.Accessor.Name);
var options = new EditOptions();
if (request.Accessor.HasAttribute<MarkdownAttribute>())
{
tag.UnEncoded().Text(new Markdown().Transform(request.RawValue== null ? "" : request.RawValue.ToString()));
options.Markdown = true;
}
options.MultiLine = request.Accessor.Name == "Details";
options.RequiresExplicitUserActionForSave = true;
options.MaximumLength = request.Accessor.PropertyType.Equals(typeof(string)) ? Entity.UnboundedStringLength : 0;
options.IsDate = request.Accessor.PropertyType.IsDateTime();
options.IsTime = request.Accessor.Name.ToLower().Contains("time");
options.IsNumber = request.Accessor.PropertyType.IsIntegerBased() || request.Accessor.PropertyType.IsFloatingPoint();
options.Required = request.Accessor.HasAttribute<RequiredAttribute>();
options.PlaceholderText = "Double-Click to edit " + request.Accessor.Name.ToLower() + ".";
var data = options.ToJson();
tag.Attr("data", "{editoptions:"+data+"}");
return tag;
}
开发者ID:rauhryan,项目名称:kokugen,代码行数:27,代码来源:EditInPlaceBuilder.cs
示例10: Build
public override void Build(ElementRequest request, HtmlTag tag)
{
tag
.AllTags()
.Where(t => t.IsInputElement())
.ForEach(t => t.AddClass("url"));
}
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:7,代码来源:UrlValidationModifier.cs
示例11: setDisabledState
private static void setDisabledState(MenuItemToken item, HtmlTag link)
{
if (item.MenuItemState == MenuItemState.Disabled)
{
link.AddClass("disabled");
}
}
开发者ID:synhershko,项目名称:FubuMVC.Bootstrap,代码行数:7,代码来源:MenuItemTag.cs
示例12: 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));
}
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:35,代码来源:ScriptTag.cs
示例13: get_conventions
public ConventionsViewModel get_conventions()
{
var configTypes = new string[]
{
ConfigurationType.Settings,
ConfigurationType.Discovery,
ConfigurationType.Explicit,
ConfigurationType.Policy,
ConfigurationType.Attributes,
ConfigurationType.ModifyRoutes,
ConfigurationType.InjectNodes,
ConfigurationType.Conneg,
ConfigurationType.Attachment,
ConfigurationType.Navigation,
ConfigurationType.ByNavigation,
ConfigurationType.Reordering,
ConfigurationType.Instrumentation
};
var tag = new HtmlTag("ul");
configTypes.Each(configType => {
tag.Add("li/a").Text(configType).Attr("href", "#" + configType);
});
return new ConventionsViewModel
{
Descriptions = new TagList(configTypes.Select(configType => new ConfigurationTypeTag(configType, _graph))),
TableOfContents = tag
};
}
开发者ID:DarthFubuMVC,项目名称:FubuMVC.Diagnostics,代码行数:31,代码来源:ConventionsFubuDiagnostics.cs
示例14: TableTag
public TableTag()
: base("table")
{
_header = new HtmlTag("thead", this);
_footer = new HtmlTag("tfoot", this).Render(false);
_body = new HtmlTag("tbody", this);
}
开发者ID:NTCoding,项目名称:FubuRaven.NTCoding.com,代码行数:7,代码来源:TableTag.cs
示例15: AddElementName
public static void AddElementName(ElementRequest request, HtmlTag tag)
{
if (tag.IsInputElement())
{
tag.Attr(HtmlAttributeConstants.Name, request.ElementId);
}
}
开发者ID:phoenixwebgroup,项目名称:Accountability,代码行数:7,代码来源:HtmlConventions.cs
示例16: AssertOptionGroup
private void AssertOptionGroup(
HtmlTag optgroup,
string display)
{
Assert.Equal("optgroup", optgroup.TagName());
Assert.Equal(display, optgroup.Attr("label"));
}
开发者ID:matutee,项目名称:Bardock.Utils,代码行数:7,代码来源:GroupedSelectTagTest.cs
示例17: AddEqualToDataAttr
public void AddEqualToDataAttr(IEnumerable<PropertyValidatorResult> propertyValidators, HtmlTag htmlTag, RequestData request)
{
var result = propertyValidators.FirstOrDefault(x => x.PropertyValidator is EqualValidator);
if (result != null)
{
var equal = result.PropertyValidator.As<EqualValidator>();
MessageFormatter formatter = new MessageFormatter()
.AppendPropertyName(result.DisplayName)
.AppendArgument("ComparisonValue", equal.ValueToCompare);
string message = formatter.BuildMessage(equal.ErrorMessageSource.GetString());
if (_msUnobtrusive)
{
htmlTag.Data("val", true);
htmlTag.Data("val-equalto", message);
if (request.Accessor.PropertyNames.Length > 1)
htmlTag.Data("val-equalto-other", request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.MemberToCompare.Name);
else
htmlTag.Data("val-equalto-other", "*." + equal.MemberToCompare.Name);
}
else
{
htmlTag.Data("msg-equalto", message);
if (request.Accessor.PropertyNames.Length > 1)
htmlTag.Data("rule-equalto", "#" + request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.MemberToCompare.Name);
else
htmlTag.Data("rule-equalto", "#" + equal.MemberToCompare.Name);
}
}
}
开发者ID:eByte23,项目名称:SchoStack,代码行数:31,代码来源:FluentValidationHtmlConventions.cs
示例18: AddValidationAttributes
public static HtmlTag AddValidationAttributes(HtmlTag tag, ModelInfo info)
{
var input = tag.FirstNonHiddenInput();
if (input == null) return tag;
input.AddValidationAttributes(info);
return tag;
}
开发者ID:Deson621,项目名称:MvcPowerTools,代码行数:7,代码来源:CommonEditorModifiers.cs
示例19: ConfigureFubuMVC
public ConfigureFubuMVC()
{
IncludeDiagnostics(true);
this.ApplyConvention<ModelValidationConfiguration>();
this.ApplyHandlerConventions<HandlersMarker>();
HtmlConvention(x => x.Editors.Always.Modify((request, tag) =>
{
var fubuRequest = request.Get<IFubuRequest>();
var validationResult = fubuRequest.Get<ValidationResult>();
if (validationResult.IsValid) return;
var ul = new HtmlTag("ul");
var liTags = validationResult.Errors.Where(error => error.PropertyName == request.Accessor.InnerProperty.Name).Select(vf => new HtmlTag("li", li => li.Text(vf.ErrorMessage)));
ul.Append(liTags);
tag.Append(ul);
}));
this.UseSpark();
Routes
.IgnoreNamespaceText("fubu101")
.HomeIs<GetHandler>(action => action.Execute(new MovieRequestModel()));
Policies.EnrichCallsWith<MovieViewModelJsonBehavior>(request => request.Returns<MovieViewModel>());
Views.TryToAttachWithDefaultConventions();
}
开发者ID:squidge,项目名称:fubu101,代码行数:29,代码来源:ConfigureFubuMVC.cs
示例20: writeScripts
private void writeScripts(HtmlTag foot)
{
// Do this regardless
foot.Append(_assets.For("FubuDiagnostics.js").ToEmbeddedScriptTag());
var routeData = _routeWriter.WriteJavascriptRoutes("FubuDiagnostics.routes", _routes);
foot.Append(routeData);
var extensionFiles = _assets.JavascriptFiles().Where(x => x.AssemblyName != "FubuMVC.Core");
if (_runtime.Mode.InDiagnostics())
{
var names = _scripts.Union(extensionFiles.Select(x => x.Name.Split('.').Reverse().Take(2).Reverse().Join(".")));
var links = _tags.BuildScriptTags(names.Select(x => "fubu-diagnostics/" + x));
links.Each(x => foot.Append(x));
}
else
{
_scripts.Each(name =>
{
var file = _assets.For(name);
foot.Append(file.ToEmbeddedScriptTag());
});
extensionFiles.Each(file => foot.Append(file.ToEmbeddedScriptTag()));
}
}
开发者ID:DarthFubuMVC,项目名称:fubumvc,代码行数:28,代码来源:FubuDiagnosticsEndpoint.cs
注:本文中的HtmlTags.HtmlTag类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论