Reputation: 65278
The !
in the doctype tag I cannot create. Is there a way to put the ! in a doctype tag using tagbuilder.
Upvotes: 1
Views: 162
Reputation: 991
Since the Doctype is not an HTML tag, you can't use TagBuilder.
Although, you can return a normal MvcHtmlString.
public static class CustomHelpers
{
public static MvcHtmlString DocType(this HtmlHelper helper)
{
var docType = @"<!DOCTYPE ...>";
return MvcHtmlString.Create(docType);
}
}
And then use it like that:
@Html.DocType()
Upvotes: 1