【问题标题】:Display image in validation在验证中显示图像
【发布时间】:2013-05-27 02:03:56
【问题描述】:

我在 ASP.Net MVC 中工作。我必须提交一个表单,我只能通过显示错误消息来验证它。但我不想在出现错误时显示text,而是想显示image。请告诉我如何在 ASP.Net 表单验证过程中显示 images,而不是 text

【问题讨论】:

  • 你在使用 jQuery 非侵入式验证吗?
  • 在服务器端代码中进行验证。
  • 您想在控件(文本框、复选框等)旁边显示图像吗????
  • 是的,我想在控件旁边显示图像,通常显示错误文本的地方。

标签: asp.net asp.net-mvc validation asp.net-mvc-4


【解决方案1】:

你可以这样使用
你可以像下面这样创建 CSS

input[type="email"] {
    background: url('images/envelope.png') no-repeat center left 5px;
    padding-left: 50px; /* depends on width of envelope image */
}
input[type="email"].input-validation-error {
    background: url('images/envelope.png') no-repeat center left 5px, url('images/cross.png') no-repeat center right 5px;
}

详情:-
MVC4 graphical validation for text box

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多