View Source
Class HtmlHelperRenderExtensions
HtmlHelper extensions for use in templates
Inheritance
System.Object
Assembly: Umbraco.Web.dll
Syntax
public static class HtmlHelperRenderExtensions
Methods
View Source
Action(HtmlHelper, String, Type)
Returns the result of a child action of a SurfaceController
Declaration
public static IHtmlString Action(this HtmlHelper htmlHelper, string actionName, Type surfaceType)
Parameters
Type |
Name |
Description |
HtmlHelper |
htmlHelper |
|
System.String |
actionName |
|
System.Type |
surfaceType |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
Action<T>(HtmlHelper, String)
Returns the result of a child action of a strongly typed SurfaceController
Declaration
public static IHtmlString Action<T>(this HtmlHelper htmlHelper, string actionName)
where T : SurfaceController
Parameters
Type |
Name |
Description |
HtmlHelper |
htmlHelper |
|
System.String |
actionName |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
Type Parameters
View Source
AreaPartial(HtmlHelper, String, String, Object, ViewDataDictionary)
Renders a partial view that is found in the specified area
Declaration
public static MvcHtmlString AreaPartial(this HtmlHelper helper, string partial, string area, object model = null, ViewDataDictionary viewData = null)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.String |
partial |
|
System.String |
area |
|
System.Object |
model |
|
ViewDataDictionary |
viewData |
|
Returns
Type |
Description |
MvcHtmlString |
|
View Source
Helper method to create a new form to execute in the Umbraco request pipeline against a locally declared controller
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline against a locally declared controller.
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, FormMethod method)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
The HTML helper.
|
System.String |
action |
Name of the action.
|
System.String |
controllerName |
Name of the controller.
|
FormMethod |
method |
The method.
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline against a locally declared controller
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, object additionalRouteVals)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
System.Object |
additionalRouteVals |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline against a locally declared controller
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, object additionalRouteVals, FormMethod method)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
System.Object |
additionalRouteVals |
|
FormMethod |
method |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline against a locally declared controller
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, object additionalRouteVals, IDictionary<string, object> htmlAttributes)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
System.Object |
additionalRouteVals |
|
System.Collections.Generic.IDictionary<System.String, System.Object> |
htmlAttributes |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline against a locally declared controller
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, object additionalRouteVals, IDictionary<string, object> htmlAttributes, FormMethod method)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
System.Object |
additionalRouteVals |
|
System.Collections.Generic.IDictionary<System.String, System.Object> |
htmlAttributes |
|
FormMethod |
method |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline against a locally declared controller
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, object additionalRouteVals, object htmlAttributes)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
System.Object |
additionalRouteVals |
|
System.Object |
htmlAttributes |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline against a locally declared controller
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, object additionalRouteVals, object htmlAttributes, FormMethod method)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
System.Object |
additionalRouteVals |
|
System.Object |
htmlAttributes |
|
FormMethod |
method |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, string area)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
System.String |
area |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, string area, FormMethod method)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
System.String |
area |
|
FormMethod |
method |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, string area, object additionalRouteVals, IDictionary<string, object> htmlAttributes)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
System.String |
area |
|
System.Object |
additionalRouteVals |
|
System.Collections.Generic.IDictionary<System.String, System.Object> |
htmlAttributes |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, string area, object additionalRouteVals, IDictionary<string, object> htmlAttributes, FormMethod method)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.String |
controllerName |
|
System.String |
area |
|
System.Object |
additionalRouteVals |
|
System.Collections.Generic.IDictionary<System.String, System.Object> |
htmlAttributes |
|
FormMethod |
method |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Type |
surfaceType |
The surface controller to route to
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType, FormMethod method)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Type |
surfaceType |
The surface controller to route to
|
FormMethod |
method |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType, object additionalRouteVals)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Type |
surfaceType |
The surface controller to route to
|
System.Object |
additionalRouteVals |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType, object additionalRouteVals, FormMethod method)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Type |
surfaceType |
The surface controller to route to
|
System.Object |
additionalRouteVals |
|
FormMethod |
method |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType, object additionalRouteVals, IDictionary<string, object> htmlAttributes)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Type |
surfaceType |
The surface controller to route to
|
System.Object |
additionalRouteVals |
|
System.Collections.Generic.IDictionary<System.String, System.Object> |
htmlAttributes |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType, object additionalRouteVals, IDictionary<string, object> htmlAttributes, FormMethod method)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Type |
surfaceType |
The surface controller to route to
|
System.Object |
additionalRouteVals |
|
System.Collections.Generic.IDictionary<System.String, System.Object> |
htmlAttributes |
|
FormMethod |
method |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType, object additionalRouteVals, object htmlAttributes)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Type |
surfaceType |
The surface controller to route to
|
System.Object |
additionalRouteVals |
|
System.Object |
htmlAttributes |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType, object additionalRouteVals, object htmlAttributes, FormMethod method)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Type |
surfaceType |
The surface controller to route to
|
System.Object |
additionalRouteVals |
|
System.Object |
htmlAttributes |
|
FormMethod |
method |
|
Returns
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action)
where T : SurfaceController
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
Returns
Type Parameters
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action, FormMethod method)
where T : SurfaceController
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
FormMethod |
method |
|
Returns
Type Parameters
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action, object additionalRouteVals)
where T : SurfaceController
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Object |
additionalRouteVals |
|
Returns
Type Parameters
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action, object additionalRouteVals, FormMethod method)
where T : SurfaceController
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Object |
additionalRouteVals |
|
FormMethod |
method |
|
Returns
Type Parameters
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action, object additionalRouteVals, IDictionary<string, object> htmlAttributes)
where T : SurfaceController
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Object |
additionalRouteVals |
|
System.Collections.Generic.IDictionary<System.String, System.Object> |
htmlAttributes |
|
Returns
Type Parameters
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action, object additionalRouteVals, IDictionary<string, object> htmlAttributes, FormMethod method)
where T : SurfaceController
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Object |
additionalRouteVals |
|
System.Collections.Generic.IDictionary<System.String, System.Object> |
htmlAttributes |
|
FormMethod |
method |
|
Returns
Type Parameters
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action, object additionalRouteVals, object htmlAttributes)
where T : SurfaceController
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Object |
additionalRouteVals |
|
System.Object |
htmlAttributes |
|
Returns
Type Parameters
View Source
Helper method to create a new form to execute in the Umbraco request pipeline to a surface controller plugin
Declaration
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action, object additionalRouteVals, object htmlAttributes, FormMethod method)
where T : SurfaceController
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
action |
|
System.Object |
additionalRouteVals |
|
System.Object |
htmlAttributes |
|
FormMethod |
method |
|
Returns
Type Parameters
View Source
CachedPartial(HtmlHelper, String, Object, Int32, Boolean, Boolean, ViewDataDictionary, Func<Object, ViewDataDictionary, String>)
Declaration
public static IHtmlString CachedPartial(this HtmlHelper htmlHelper, string partialViewName, object model, int cachedSeconds, bool cacheByPage = false, bool cacheByMember = false, ViewDataDictionary viewData = null, Func<object, ViewDataDictionary, string> contextualKeyBuilder = null)
Parameters
Type |
Name |
Description |
HtmlHelper |
htmlHelper |
|
System.String |
partialViewName |
|
System.Object |
model |
|
System.Int32 |
cachedSeconds |
|
System.Boolean |
cacheByPage |
|
System.Boolean |
cacheByMember |
|
ViewDataDictionary |
viewData |
|
System.Func<System.Object, ViewDataDictionary, System.String> |
contextualKeyBuilder |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
Coalesce(HtmlHelper, Object[])
Will take the first non-null value in the collection and return the value of it.
Declaration
public static string Coalesce(this HtmlHelper helper, params object[] args)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.Object[] |
args |
|
Returns
Type |
Description |
System.String |
|
View Source
Concatenate(HtmlHelper, Object[])
Joins any number of int/string/objects into one string
Declaration
public static string Concatenate(this HtmlHelper helper, params object[] args)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.Object[] |
args |
|
Returns
Type |
Description |
System.String |
|
View Source
CreateHash(HtmlHelper, String)
Generates a hash based on the text string passed in. This method will detect the
security requirements (is FIPS enabled) and return an appropriate hash.
Declaration
public static string CreateHash(this HtmlHelper helper, string text)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.String |
text |
The text to create a hash from
|
Returns
Type |
Description |
System.String |
Hash of the text string
|
View Source
EditorFor<T>(HtmlHelper, String, String, Object)
Declaration
public static MvcHtmlString EditorFor<T>(this HtmlHelper htmlHelper, string templateName = "", string htmlFieldName = "", object additionalViewData = null)
where T : new()
Parameters
Type |
Name |
Description |
HtmlHelper |
htmlHelper |
|
System.String |
templateName |
|
System.String |
htmlFieldName |
|
System.Object |
additionalViewData |
|
Returns
Type |
Description |
MvcHtmlString |
|
Type Parameters
View Source
If(HtmlHelper, Boolean, String)
If test
is true
, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public static IHtmlString If(this HtmlHelper html, bool test, string valueIfTrue)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
The HTML helper.
|
System.Boolean |
test |
If set to true returns valueIfTrue ; otherwise, System.String.Empty.
|
System.String |
valueIfTrue |
The value if true .
|
Returns
Type |
Description |
System.Web.IHtmlString |
The HTML encoded value.
|
View Source
If(HtmlHelper, Boolean, String, String)
If test
is true
, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public static IHtmlString If(this HtmlHelper html, bool test, string valueIfTrue, string valueIfFalse)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
The HTML helper.
|
System.Boolean |
test |
If set to true returns valueIfTrue ; otherwise, valueIfFalse .
|
System.String |
valueIfTrue |
The value if true .
|
System.String |
valueIfFalse |
The value if false .
|
Returns
Type |
Description |
System.Web.IHtmlString |
The HTML encoded value.
|
View Source
Join(HtmlHelper, String, Object[])
Joins any number of int/string/objects into one string and separates them with the string separator parameter.
Declaration
public static string Join(this HtmlHelper helper, string separator, params object[] args)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.String |
separator |
|
System.Object[] |
args |
|
Returns
Type |
Description |
System.String |
|
View Source
PreviewBadge(HtmlHelper)
Will render the preview badge when in preview mode which is not required ever unless the MVC page you are
using does not inherit from UmbracoViewPage
Declaration
public static MvcHtmlString PreviewBadge(this HtmlHelper helper)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
Returns
Type |
Description |
MvcHtmlString |
|
View Source
RenderProfiler(HtmlHelper)
Renders the markup for the profiler
Declaration
public static IHtmlString RenderProfiler(this HtmlHelper helper)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
ReplaceLineBreaks(HtmlHelper, String)
HTML encodes the text and replaces text line breaks with HTML line breaks.
Declaration
public static IHtmlString ReplaceLineBreaks(this HtmlHelper helper, string text)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
The HTML helper.
|
System.String |
text |
The text.
|
Returns
Type |
Description |
System.Web.IHtmlString |
The HTML encoded text with text line breaks replaced with HTML line breaks (<br /> ).
|
View Source
ReplaceLineBreaksForHtml(HtmlHelper, String)
Replaces text line breaks with HTML line breaks.
Declaration
[Obsolete("This method doesn't HTML encode the text. Use ReplaceLineBreaks instead.")]
public static IHtmlString ReplaceLineBreaksForHtml(this HtmlHelper helper, string text)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
The HTML helper.
|
System.String |
text |
The text.
|
Returns
Type |
Description |
System.Web.IHtmlString |
The text with text line breaks replaced with HTML line breaks (<br /> ).
|
View Source
StripHtml(HtmlHelper, String, String[])
Strips all HTML tags from a given string, all contents of the tags will remain.
Declaration
public static IHtmlString StripHtml(this HtmlHelper helper, string html, params string[] tags)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.String |
html |
|
System.String[] |
tags |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
StripHtml(HtmlHelper, IHtmlString, String[])
Strips all HTML tags from a given string, all contents of the tags will remain.
Declaration
public static IHtmlString StripHtml(this HtmlHelper helper, IHtmlString html, params string[] tags)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.Web.IHtmlString |
html |
|
System.String[] |
tags |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
Truncate(HtmlHelper, String, Int32)
Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them
Declaration
public static IHtmlString Truncate(this HtmlHelper helper, string html, int length)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.String |
html |
|
System.Int32 |
length |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
Truncate(HtmlHelper, String, Int32, Boolean)
Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them
Declaration
public static IHtmlString Truncate(this HtmlHelper helper, string html, int length, bool addElipsis)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.String |
html |
|
System.Int32 |
length |
|
System.Boolean |
addElipsis |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
Truncate(HtmlHelper, String, Int32, Boolean, Boolean)
Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them
Declaration
public static IHtmlString Truncate(this HtmlHelper helper, string html, int length, bool addElipsis, bool treatTagsAsContent)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.String |
html |
|
System.Int32 |
length |
|
System.Boolean |
addElipsis |
|
System.Boolean |
treatTagsAsContent |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
Truncate(HtmlHelper, IHtmlString, Int32)
Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them
Declaration
public static IHtmlString Truncate(this HtmlHelper helper, IHtmlString html, int length)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.Web.IHtmlString |
html |
|
System.Int32 |
length |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
Truncate(HtmlHelper, IHtmlString, Int32, Boolean)
Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them
Declaration
public static IHtmlString Truncate(this HtmlHelper helper, IHtmlString html, int length, bool addElipsis)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.Web.IHtmlString |
html |
|
System.Int32 |
length |
|
System.Boolean |
addElipsis |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
Truncate(HtmlHelper, IHtmlString, Int32, Boolean, Boolean)
Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them
Declaration
public static IHtmlString Truncate(this HtmlHelper helper, IHtmlString html, int length, bool addElipsis, bool treatTagsAsContent)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.Web.IHtmlString |
html |
|
System.Int32 |
length |
|
System.Boolean |
addElipsis |
|
System.Boolean |
treatTagsAsContent |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
TruncateByWords(HtmlHelper, String, Int32)
Truncates a string to a given amount of words, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them
Declaration
public static IHtmlString TruncateByWords(this HtmlHelper helper, string html, int words)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.String |
html |
|
System.Int32 |
words |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
TruncateByWords(HtmlHelper, String, Int32, Boolean)
Truncates a string to a given amount of words, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them
Declaration
public static IHtmlString TruncateByWords(this HtmlHelper helper, string html, int words, bool addElipsis)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.String |
html |
|
System.Int32 |
words |
|
System.Boolean |
addElipsis |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
TruncateByWords(HtmlHelper, IHtmlString, Int32)
Truncates a string to a given amount of words, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them
Declaration
public static IHtmlString TruncateByWords(this HtmlHelper helper, IHtmlString html, int words)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.Web.IHtmlString |
html |
|
System.Int32 |
words |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
TruncateByWords(HtmlHelper, IHtmlString, Int32, Boolean)
Truncates a string to a given amount of words, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them
Declaration
public static IHtmlString TruncateByWords(this HtmlHelper helper, IHtmlString html, int words, bool addElipsis)
Parameters
Type |
Name |
Description |
HtmlHelper |
helper |
|
System.Web.IHtmlString |
html |
|
System.Int32 |
words |
|
System.Boolean |
addElipsis |
|
Returns
Type |
Description |
System.Web.IHtmlString |
|
View Source
ValidationSummary(HtmlHelper, String, Boolean, String, IDictionary<String, Object>)
A validation summary that lets you pass in a prefix so that the summary only displays for elements
containing the prefix. This allows you to have more than on validation summary on a page.
Declaration
public static MvcHtmlString ValidationSummary(this HtmlHelper htmlHelper, string prefix = "", bool excludePropertyErrors = false, string message = "", IDictionary<string, object> htmlAttributes = null)
Parameters
Type |
Name |
Description |
HtmlHelper |
htmlHelper |
|
System.String |
prefix |
|
System.Boolean |
excludePropertyErrors |
|
System.String |
message |
|
System.Collections.Generic.IDictionary<System.String, System.Object> |
htmlAttributes |
|
Returns
Type |
Description |
MvcHtmlString |
|
View Source
Wrap(HtmlHelper, Boolean, String, String, Object, IHtmlTagWrapper[])
Declaration
public static HtmlTagWrapper Wrap(this HtmlHelper html, bool visible, string tag, string innerText, object anonymousAttributes, params IHtmlTagWrapper[] children)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.Boolean |
visible |
|
System.String |
tag |
|
System.String |
innerText |
|
System.Object |
anonymousAttributes |
|
IHtmlTagWrapper[] |
children |
|
Returns
View Source
Wrap(HtmlHelper, String, Object)
Declaration
public static HtmlTagWrapper Wrap(this HtmlHelper html, string tag, object inner)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
tag |
|
System.Object |
inner |
|
Returns
View Source
Wrap(HtmlHelper, String, Object, Object, IHtmlTagWrapper[])
Declaration
public static HtmlTagWrapper Wrap(this HtmlHelper html, string tag, object inner, object anonymousAttributes, params IHtmlTagWrapper[] children)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
tag |
|
System.Object |
inner |
|
System.Object |
anonymousAttributes |
|
IHtmlTagWrapper[] |
children |
|
Returns
View Source
Wrap(HtmlHelper, String, String, Object, IHtmlTagWrapper[])
Declaration
public static HtmlTagWrapper Wrap(this HtmlHelper html, string tag, string innerText, object anonymousAttributes, params IHtmlTagWrapper[] children)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
tag |
|
System.String |
innerText |
|
System.Object |
anonymousAttributes |
|
IHtmlTagWrapper[] |
children |
|
Returns
View Source
Wrap(HtmlHelper, String, String, IHtmlTagWrapper[])
Declaration
public static HtmlTagWrapper Wrap(this HtmlHelper html, string tag, string innerText, params IHtmlTagWrapper[] children)
Parameters
Type |
Name |
Description |
HtmlHelper |
html |
|
System.String |
tag |
|
System.String |
innerText |
|
IHtmlTagWrapper[] |
children |
|
Returns