你如何防止编辑mvc中的远程验证 [英] how do you prevent remote validation in edit mvc

查看:65
本文介绍了你如何防止编辑mvc中的远程验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



当我在mvc和c#中建立项目时,我遇到了一些问题。我检查了数据库中唯一名称的用户名,所以我在数据中使用了远程验证注释。当我创建新用户时,我的工作很棒,但是当我尝试编辑用户时,它会产生问题并给我错误用户名已经存在。请尽快给我一些解决方案。

Hi Friends,

I have some problem when i implimented project in mvc and c#.I checked username for unique name in database so i used remote validation in data annotation.Its great work in when i create new user but when i am trying to work on edit user then it will create problem and give me error username is already exists.please give me some solution as soon as possible.

推荐答案

听起来好像你正在使用相同的视图来创建和编辑。如果您的解决方案很简单,请不要这样做。



这是两个独立的操作,具有不同的验证要求。







您已经使用了单独的视图,并且两者都使用相同的验证方案。别。我不能告诉你这是多么分开,因为你可以用多种方式进行验证而你从未说过如何设置你的验证方案。
It sounds as though you're using the same view to do Create and Edit. If you are the solution is simple, don't do that.

Those are two separate operations that have differing validation requirements.

OR

You'r using separate views already and are using the same validation scheme for both. Don't. I can't tell you how separate that because you can do validation in multiple ways and you never said how your validation scheme is setup.


这篇关于你如何防止编辑mvc中的远程验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆