Class XFormExtensions

Contains extension methods related to XForm for System.Web.Mvc.HtmlHelper.

Inheritance
System.Object
XFormExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web.Mvc.Html
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
public static class XFormExtensions

Methods

BeginXForm(HtmlHelper, PropertyXForm)

Returns an MvcForm containing an opening <form> element for the specified PropertyXForm with the action and method attributes set.

Declaration
public static MvcForm BeginXForm(this HtmlHelper htmlHelper, PropertyXForm xFormProperty)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

PropertyXForm xFormProperty

The PropertyXForm for which the opening tag should be returned.

Returns
Type Description
System.Web.Mvc.Html.MvcForm

An MvcForm containing the opening <form> element for the specified PropertyXForm.

BeginXForm(HtmlHelper, PropertyXForm, Object)

Returns an MvcForm containing an opening <form> element for the specified PropertyXForm with the action and method attributes set.

Declaration
public static MvcForm BeginXForm(this HtmlHelper htmlHelper, PropertyXForm xFormProperty, object htmlAttributes)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

PropertyXForm xFormProperty

The PropertyXForm for which the opening tag should be returned.

System.Object htmlAttributes

Additional attributes for the <form> element.

Returns
Type Description
System.Web.Mvc.Html.MvcForm

An MvcForm containing the opening <form> element for the specified PropertyXForm.

BeginXForm(HtmlHelper, PropertyXForm, Object, LocalizationService)

Returns an MvcForm containing an opening <form> element for the specified PropertyXForm with the action and method attributes set.

Declaration
public static MvcForm BeginXForm(this HtmlHelper htmlHelper, PropertyXForm xFormProperty, object htmlAttributes, LocalizationService localizationService)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

PropertyXForm xFormProperty

The PropertyXForm for which the opening tag should be returned.

System.Object htmlAttributes

Additional attributes for the <form> element.

LocalizationService localizationService

The resource locator that should be used by the instance to get localized strings.

Returns
Type Description
System.Web.Mvc.Html.MvcForm

An MvcForm containing the opening <form> element for the specified PropertyXForm.

BeginXForm(HtmlHelper, XFormPostedData)

Declaration
public static MvcForm BeginXForm(this HtmlHelper htmlHelper, XFormPostedData xFormPostData)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper
XFormPostedData xFormPostData
Returns
Type Description
System.Web.Mvc.Html.MvcForm

BeginXForm(HtmlHelper, XFormPostedData, Object)

Returns an MvcForm containing an opening <form> element for the XForm stored in the specified XFormPostedData with the action and method attributes set.

Declaration
public static MvcForm BeginXForm(this HtmlHelper htmlHelper, XFormPostedData xFormPostData, object htmlAttributes)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

XFormPostedData xFormPostData

The XFormPostedData containing the XForm for which the opening tag should be returned.

System.Object htmlAttributes

Additional attributes for the <form> element.

Returns
Type Description
System.Web.Mvc.Html.MvcForm

An MvcForm containing the opening <form> element for the XForm stored in the specified XFormPostedData.

BeginXForm(HtmlHelper, XForm)

Declaration
public static MvcForm BeginXForm(this HtmlHelper htmlHelper, XForm xForm)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper
XForm xForm
Returns
Type Description
System.Web.Mvc.Html.MvcForm

BeginXForm(HtmlHelper, XForm, Object)

Declaration
public static MvcForm BeginXForm(this HtmlHelper htmlHelper, XForm xForm, object htmlAttributes)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper
XForm xForm
System.Object htmlAttributes
Returns
Type Description
System.Web.Mvc.Html.MvcForm

BeginXForm(HtmlHelper, XForm, Object, LocalizationService)

Returns an MvcForm containing an opening <form> element for the specified XForm with the action and method attributes set.

Declaration
public static MvcForm BeginXForm(this HtmlHelper htmlHelper, XForm xForm, object htmlAttributes, LocalizationService localizationService)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

XForm xForm

The XForm for which the opening tag should be returned.

System.Object htmlAttributes

Additional attributes for the <form> element.

LocalizationService localizationService

The resource locator that should be used by the instance to get localized strings.

Returns
Type Description
System.Web.Mvc.Html.MvcForm

An MvcForm containing the opening <form> element for the specified XForm.

EndXForm(HtmlHelper)

Writes a closing </form> element to the view context's output stream.

Declaration
public static void EndXForm(this HtmlHelper htmlHelper)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

PropertyXForm(HtmlHelper, PropertyData)

Returns the XForm stored in the specified PropertyXForm.

Declaration
public static MvcHtmlString PropertyXForm(this HtmlHelper htmlHelper, PropertyData propertyData)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

PropertyData propertyData

The property whose XForm to return.

Returns
Type Description
System.Web.Mvc.MvcHtmlString

An MvcForm containing the XForm.

Remarks

The named property will be fetched from the requested CMS page in the current web request.

The XForm content is divided into fragments and each fragment is rendered by its corresponding editor template.

This method is less efficient than RenderPropertyXForm(HtmlHelper, String) due to the fact that it needs to create a large string.

Exceptions
Type Condition
System.ArgumentException

Thrown if propertyData is not a PropertyXForm.

PropertyXForm(HtmlHelper, PropertyData, XFormParameters)

Returns the XForm stored in the specified PropertyXForm.

Declaration
public static MvcHtmlString PropertyXForm(this HtmlHelper htmlHelper, PropertyData propertyData, XFormParameters parameters)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

PropertyData propertyData

The property whose XForm to return.

XFormParameters parameters

The parameters to be used by the XForm.

Returns
Type Description
System.Web.Mvc.MvcHtmlString

An MvcForm containing the XForm.

Remarks

The named property will be fetched from the requested CMS page in the current web request.

The XForm content is divided into fragments and each fragment is rendered by its corresponding editor template.

This method is less efficient than RenderPropertyXForm(HtmlHelper, PropertyData, XFormParameters) due to the fact that it needs to create a large string.

Exceptions
Type Condition
System.ArgumentException

Thrown if propertyData is not a PropertyXForm.

PropertyXForm(HtmlHelper, String)

Returns the XForm stored in the named PropertyXForm on the routed page as a string.

Declaration
public static MvcHtmlString PropertyXForm(this HtmlHelper htmlHelper, string propertyName)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

System.String propertyName

The name of the property whose XForm to return.

Returns
Type Description
System.Web.Mvc.MvcHtmlString

An MvcForm containing the XForm.

Remarks

The named property will be fetched from the requested CMS page in the current web request.

The XForm content is divided into fragments and each fragment is rendered by its corresponding editor template.

This method is less efficient than RenderPropertyXForm(HtmlHelper, String) due to the fact that it needs to create a large string.

Exceptions
Type Condition
System.ArgumentException

Thrown if propertyName references a property that is not of type PropertyXForm.

System.ArgumentNullException

Thrown if propertyName is null.

PropertyXForm(HtmlHelper, String, XFormParameters)

Returns the XForm stored in the named PropertyXForm on the routed page as a string.

Declaration
public static MvcHtmlString PropertyXForm(this HtmlHelper htmlHelper, string propertyName, XFormParameters parameters)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

System.String propertyName

The name of the property whose XForm to return.

XFormParameters parameters

The parameters to be used by the XForm.

Returns
Type Description
System.Web.Mvc.MvcHtmlString

An MvcForm containing the XForm.

Remarks

The named property will be fetched from the requested CMS page in the current web request.

The XForm content is divided into fragments and each fragment is rendered by its corresponding editor template.

This method is less efficient than RenderPropertyXForm(HtmlHelper, String, XFormParameters) due to the fact that it needs to create a large string.

Exceptions
Type Condition
System.ArgumentException

Thrown if propertyName references a property that is not of type PropertyXForm.

System.ArgumentNullException

Thrown if propertyName is null.

RenderPropertyXForm(HtmlHelper, PropertyData)

Writes the XForm stored in the named PropertyXForm to the view context's output steam.

Declaration
public static void RenderPropertyXForm(this HtmlHelper htmlHelper, PropertyData propertyData)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

PropertyData propertyData

The property whose XForm to write.

Remarks

The named property will be fetched from the requested CMS page in the current web request.

The XForm content is divided into fragments and each fragment is rendered by its corresponding editor template.

Exceptions
Type Condition
System.ArgumentException

Thrown if propertyData is not a PropertyXForm.

RenderPropertyXForm(HtmlHelper, PropertyData, XFormParameters)

Writes the XForm stored in the named PropertyXForm to the view context's output steam.

Declaration
public static void RenderPropertyXForm(this HtmlHelper htmlHelper, PropertyData propertyData, XFormParameters parameters)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

PropertyData propertyData

The property whose XForm to write.

XFormParameters parameters

The parameters to be used by the XForm.

Remarks

The named property will be fetched from the requested CMS page in the current web request.

The XForm content is divided into fragments and each fragment is rendered by its corresponding editor template.

Exceptions
Type Condition
System.ArgumentException

Thrown if propertyData is not a PropertyXForm.

RenderPropertyXForm(HtmlHelper, String)

Writes the XForm stored in the named PropertyXForm on the routed page to the view context's output steam.

Declaration
public static void RenderPropertyXForm(this HtmlHelper htmlHelper, string propertyName)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

System.String propertyName

The name of the property whose XForm to write.

Remarks

The named property will be fetched from the requested CMS page in the current web request.

The XForm content is divided into fragments and each fragment is rendered by its corresponding editor template.

Exceptions
Type Condition
System.ArgumentException

Thrown if propertyName references a property that is not of type PropertyXForm.

System.ArgumentNullException

Thrown if propertyName is null.

RenderPropertyXForm(HtmlHelper, String, XFormParameters)

Writes the XForm stored in the named PropertyXForm on the routed page to the view context's output steam.

Declaration
public static void RenderPropertyXForm(this HtmlHelper htmlHelper, string propertyName, XFormParameters parameters)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

System.String propertyName

The name of the property whose XForm to write.

XFormParameters parameters

The parameters to be used by the XForm.

Remarks

The named property will be fetched from the requested CMS page in the current web request.

The XForm content is divided into fragments and each fragment is rendered by its corresponding editor template.

Exceptions
Type Condition
System.ArgumentException

Thrown if propertyName references a property that is not of type PropertyXForm.

System.ArgumentNullException

Thrown if propertyName is null.

RenderXForm(HtmlHelper, XForm)

Declaration
public static void RenderXForm(this HtmlHelper htmlHelper, XForm xform)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper
XForm xform

RenderXForm(HtmlHelper, XForm, XFormParameters)

Writes the XForm to the view context's output steam.

Declaration
public static void RenderXForm(this HtmlHelper htmlHelper, XForm xform, XFormParameters parameters)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

XForm xform

The XForm to write.

XFormParameters parameters

The parameters to be used by the XForm.

XForm(HtmlHelper, XForm)

Declaration
public static MvcHtmlString XForm(this HtmlHelper htmlHelper, XForm xform)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper
XForm xform
Returns
Type Description
System.Web.Mvc.MvcHtmlString

XForm(HtmlHelper, XForm, XFormParameters)

Returns the XForm as a string with specified XForm parameters.

Declaration
public static MvcHtmlString XForm(this HtmlHelper htmlHelper, XForm xform, XFormParameters parameters)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

XForm xform

The XForm to return.

XFormParameters parameters

The parameters to be used by the XForm.

Returns
Type Description
System.Web.Mvc.MvcHtmlString

An MvcForm containing the XForm.

Remarks

The XForm content is divided into fragments and each fragment is rendered by its corresponding editor template.

This method is less efficient than RenderXForm(HtmlHelper, XForm, XFormParameters) due to the fact that it needs to create a large string.

XFormValidationMessage(HtmlHelper, XForm)

Displays a validation message if an error exists for the none specified field in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString XFormValidationMessage(this HtmlHelper htmlHelper, XForm xform)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The HTML helper instance that this method extends.

XForm xform

The requested xform

Returns
Type Description
System.Web.Mvc.MvcHtmlString