ASP.NET MVC3 中设置htmlAttribute
生活随笔
收集整理的這篇文章主要介紹了
ASP.NET MVC3 中设置htmlAttribute
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
直接上實(shí)例
假如有個(gè)表單,你需要設(shè)置表單中的輸入框不自動(dòng)記憶以前輸入的內(nèi)容時(shí),一般的HTML中的寫法是
<form autocomplete="off"><!-- 表單中的內(nèi)容 --> </form>其中autocomplete是表單中的屬性,那么在你用Html.BeginForm生成表單時(shí),需要設(shè)置htmlAttrbutes參數(shù),如下
@using (Html.BeginForm("ActionName", "ControllerName", FormMethod.Post, new { autocomplete = "off" })) { @*表單元素*@ }其中new { autocomplete = "off" }就是htmlAttrbutes參數(shù)。
?
再例如
@Html.ActionLink("linktext", "actionName", new { routeValues = 1 }, new { title = "鼠標(biāo)移入提示", target = "_blank" })?
轉(zhuǎn)載于:https://www.cnblogs.com/leiOOlei/archive/2012/08/01/2618334.html
總結(jié)
以上是生活随笔為你收集整理的ASP.NET MVC3 中设置htmlAttribute的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: HTTP协议实体的基本讲解
- 下一篇: MongoDB监控及报警