直接上实例

假如有个表单,你需要设置表单中的输入框不自动记忆以前输入的内容时,一般的HTML中的写法是

<form autocomplete="off">
    <!-- 表单中的内容 -->
</form>

其中autocomplete是表单中的属性,那么在你用Html.BeginForm生成表单时,需要设置htmlAttrbutes参数,如下

@using (Html.BeginForm("ActionName", "ControllerName", FormMethod.Post, new { autocomplete = "off" }))
{
@*表单元素*@
}

其中new { autocomplete = "off" }就是htmlAttrbutes参数。

 

再例如

@Html.ActionLink("linktext", "actionName", new { routeValues = 1 }, new { title = "鼠标移入提示", target = "_blank" })

 

相关文章:

  • 2021-10-26
  • 2021-08-25
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
  • 2021-07-25
  • 2022-01-11
猜你喜欢
  • 2021-11-17
  • 2022-01-23
  • 2022-12-23
  • 2021-12-04
  • 2021-09-14
  • 2021-11-15
  • 2021-07-26
相关资源
相似解决方案