Razor HTML Tags

Source: Internet
Author: User

1. Label

HTML syntax:
<for = "UserName"> user name </label>
@ Html.labelfor (m=>m.username)@html.label ("first + (i+ 1) +" page ")

2. Text


<IDvalue= ""/>
@ Html.textboxfor (m=>m.username)
@ Html.textbox ("linproductid")

3, Hidden

HTML syntax:
<ID name Typevalue ="" /> Razor Syntax:
@ Html.hiddenfor (m=>m.username)@html.hidden ("choosed", convert.tostring (viewdata["choosed"]))

4, Password


<IDname type/> Razorsyntax:
@ Html.passwordfor (m=>m.userpass)@html.password ("txtpassword", "", New {@id = "txtpassword"})

5, Radio

HTML syntax:
<inputID= "sex0"name= "sex"type= "radio"value= ' 0 '/>male<inputID= "sex1"name= "sex"type= "radio"value= ' 1 '/>Female Razor Grammar:
@ Html.radiobuttonfor (m=>m.sex,0,new {id= "sex0"}) male @html.radiobuttonfor (m=>m.sex,1,new {id= "sex1"}) Female
@ Html.radiobutton ("nolimitage", 0, New {@Name = "limit", @checked = "checked", @onclick = "clicknolimit ()"}) Unrestricted
@ Html.radiobutton ("limitage", 1, New {@Name = "limit", @onclick = "clicklimit ()"}) limit

6. CheckBox

HTML syntax:
<IDname Typevalue = "true" />Razor syntax:
@ Html.checkboxfor (m = m.isremember) Next automatic login @html.checkbox ("checkall", New {id = "checkall", onclick = "Chec KAll () "})

7, DropdownList

HTML syntax:<SelectID= "ddldepartment"name= "ddldepartment">
<optionvalue= "-1">Please select</option>
</Select><SelectID= "ddlman"name= "man">
<optionvalue= "-1">Please select</option>
</Select>Razor syntax: @html.dropdownlist ("ddldepartment", new List<SelectListItem>{new SelectListItem {Text = "please select", Value = "1"}}, new {id = "ddldepartment", name = "ddldepartment"}) @ Html.dropdownlistfor (m = m.man, new List<SelectListItem>{new SelectListItem {Text = "please select", Value = "1"}}, new {id = "ddlman"})

8, A

<href= "/***/orderprocessdetail?orderserialid=xxx&amp; Channel=payreminder "  target=" _blank ">123456</a>  Razor syntax:   @html.actionlink (item. customerserialid, "orderprocessdetail", "* * *", new {orderserialid = Item. orderserialid, channel = request["channel"]}, new {target = "_blank"})

9. IMG

Html syntax:<src= "/content/images/1.jpg"/>Razor syntax:  <src= "@Url. Content ("~/content/images/1.jpg ")"></  script>

10. CSS

Html syntax:<href= "/content/style.css"/>Razor syntax:  <href= "@Url. Content ("/>

11, JS

Html syntax:<src= "/content/jquery.js"></script  >Razor syntax:<src= "@Url. Content ("~/content/ Jquery.js ")"></script>

12, Quote JS

@section Scripts {    @Scripts. Render ("~/bundles/jqueryval")}

13. Notes

@* Notes *@

Razor HTML Tags

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.