次の方法で共有


TextAreaExtensions Class

Represents support for HTML textarea controls.

Inheritance Hierarchy

System.Object
  System.Web.Mvc.Html.TextAreaExtensions

Namespace:  System.Web.Mvc.Html
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public NotInheritable Class TextAreaExtensions
public static class TextAreaExtensions
[ExtensionAttribute]
public ref class TextAreaExtensions abstract sealed

Methods

  Name Description
Public methodStatic member TextArea(HtmlHelper, String) Returns the specified textarea element by using the specified HTML helper and the name of the form field.
Public methodStatic member TextArea(HtmlHelper, String, IDictionary<String, Object>) Returns the specified textarea element by using the specified HTML helper, the name of the form field, and the specified HTML attributes.
Public methodStatic member TextArea(HtmlHelper, String, Object) Returns the specified textarea element by using the specified HTML helper and HTML attributes.
Public methodStatic member TextArea(HtmlHelper, String, String) Returns the specified textarea element by using the specified HTML helper, the name of the form field, and the text content.
Public methodStatic member TextArea(HtmlHelper, String, String, IDictionary<String, Object>) Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, and the specified HTML attributes.
Public methodStatic member TextArea(HtmlHelper, String, String, Object) Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, and the specified HTML attributes.
Public methodStatic member TextArea(HtmlHelper, String, String, Int32, Int32, IDictionary<String, Object>) Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, the number of rows and columns, and the specified HTML attributes.
Public methodStatic member TextArea(HtmlHelper, String, String, Int32, Int32, Object) Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, the number of rows and columns, and the specified HTML attributes.
Public methodStatic member TextAreaFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>) Returns an HTML textarea element for each property in the object that is represented by the specified expression.
Public methodStatic member TextAreaFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, IDictionary<String, Object>) Returns an HTML textarea element for each property in the object that is represented by the specified expression using the specified HTML attributes.
Public methodStatic member TextAreaFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, Object) Returns an HTML textarea element for each property in the object that is represented by the specified expression using the specified HTML attributes.
Public methodStatic member TextAreaFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, Int32, Int32, IDictionary<String, Object>) Returns an HTML textarea element for each property in the object that is represented by the specified expression using the specified HTML attributes and the number of rows and columns.
Public methodStatic member TextAreaFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, Int32, Int32, Object) Returns an HTML textarea element for each property in the object that is represented by the specified expression using the specified HTML attributes and the number of rows and columns.

Top

Remarks

The TextAreaExtensions class contains methods that extend the HtmlHelper class. Each extension method renders an HTML textarea element. The TextArea method renders an element that enables the user to enter multiple lines of text that is then submitted to the Web server.

Examples

The following example shows how to create a form that enables the user to enter text for an article and to enter the article title. The form provides a TextArea helper method that is used to enter the article text. The method also passes an anonymous object that contains the HTML attributes that are used to render the textarea element.

When the user submits the form, the TextArea action method handles the request. This method uses a regular expression to replace newline (\n) characters with HTML br elements in order to retain paragraph formatting.

The following example shows the view that is rendered in order to display the text that was submitted.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Web.Mvc.Html Namespace

Other Resources

Rendering a Form in ASP.NET MVC Using HTML Helpers