gpt4 book ai didi

html - 使用 Html 帮助程序显示工具提示

转载 作者:太空宇宙 更新时间:2023-11-04 15:03:40 25 4
gpt4 key购买 nike

我想像这样向我的 Razor View 添加工具提示:

   @Html.Editor("Password", new { Title = "Doit contenir au moins une lettre majuscule, une minuscule, un chiffre et un caractère spécial" }) 

它不起作用,如果我只是通过输入 html 标记更改 html 帮助器,它就起作用了!!

我需要知道:

  1. 这个错误的原因在哪里?
  2. 我该如何解决?

最佳答案

使用 Html.EditorFor() 添加 html 属性,仅在 MVC-5.1+ 中受支持。如果你有 MVC-5.1,那么正确的用法是

@Html.EditorFor(m => m.Password, new { htmlAttributes = new { Title = "Doit contenir ... spécial" }, })

否则,您需要使用 @Html.Password()@Html.PasswordFor() 方法

@Html.PasswordFor(m => m.Password, new { Title = "Doit contenir ... spécial"  })

Refer documentation

关于html - 使用 Html 帮助程序显示工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30737537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com