tags (tag) in ASP. NET MVC View

Source: Internet
Author: User

When editing view, you will use various HTML tags, such as <a>,<input>,<p> wait, these tags in ASP. NET MVC has the corresponding programming syntax, it is called Razor, it is to help us dynamically generate HTML tags , the benefit is that data can be bound.

Now let's review the use of HTML tags: <input> because it is one of the most commonly used form labels, start with it first.

can go: http://www.w3cschool.cn/htmltags/tag-label.html look at its definition.

The basic is to receive user input data, in order to send a form to the daemon processing, in ASP. NET MVC, should be submitted to the controller action method processing.

<input> tags depending on the value of the type attribute, the representation is different, you can take a place here: http://www.w3cschool.cn/htmltags/att-input-type.html

For example:

<input type= "Text"/> Default. Defines a single-line text field (the default width is 20 characters).
<input type= "button" value= "buttons display text" > Define clickable buttons (typically used with JavaScript to launch scripts).
<input type= "checkbox" > Text Define the check box.
<input type= "File" > Define file Selection fields and "Browse ..." button for file upload.
<input type= "hidden" > Defines the hidden input field. For the value that the user does not need to see but the application needs
<input type= "image" src= "Http://www.cnblogs.com/images/logo_small.gif" > Define the image as the submit button.
<input type= "Password" > Defines the password field (the characters in the field are obscured).
<input type= "Radio" > Radio button Defines a radio button.
<input type= "Submit" value= "Submission button" > Define the Submit button.
There are other HTML5 high-level labels, etc...   

Each of the above tags corresponds to an ASP. HtmlHelper method, which has many overloads

such as <input type= "text" > single-line text input box, corresponding to the @html.textbox ("name") dynamically generated tags are: <input id= "name" name= "name" type= "text" Value= "" >

The following is an overloaded list

Method name Description
TextBox (HtmlHelper, String) Returns a text INPUT element by using the specified HTML helper and the name of the form field .
TextBox (HtmlHelper, String, Object) Returns a text INPUT element by using the specified HTML helper, the name of the form field, and the value .
TextBox (HtmlHelper, String, object, IDictionary<string, Object>) Returns a text INPUT element by using the specified HTML helper, the name of the form field, the value, and the HTML attribute .
TextBox (HtmlHelper, String, Object, Object) Returns a text INPUT element by using the specified HTML helper, the name of the form field, the value, and the HTML attribute .
TextBox (HtmlHelper, String, Object, String) Returns a text INPUT element.
TextBox (HtmlHelper, String, Object, String, IDictionary<string, Object>) Returns a text INPUT element.
TextBox (HtmlHelper, String, object, String, object) Returns a text INPUT element.

tags (tag) in ASP. NET MVC View

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.