是否可以将确认密码文本框的文本与@Html.PasswordFor(model=>model.Password)
?
@using (Html.BeginForm())
{
<table>
<tr>
<td>@Html.LabelFor(model => model.Password)</td>
<td>@Html.PasswordFor(model => model.Password)</td>
<td>@Html.ValidationMessageFor(model => model.Password)</td>
</tr>
@*Here I want to take "Confirm Password" and want to compare it with "Password" in View(.cshtml only) as
I have not taken ConfirmPassword in my model.*@
<tr>
<td>
<input type="submit" value="Create" />
</td>
</tr>
</table>
}
请提出任何方法或解决方案,
如何在没有获得Model中的确认密码属性的情况下
compare password
和confirm password
。谢谢....
最佳答案
使用Compare
DataAnnotation
比较密码很容易,但是如果从数据库生成模型,则使用NotMapped
,
关于asp.net-mvc - 比较密码并在ASP.Net MVC中确认密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21746910/