什么是使用ASP.NET MVC实现字段验证的最好方法? [英] What's the best way to implement field validation using ASP.NET MVC?

查看:181
本文介绍了什么是使用ASP.NET MVC实现字段验证的最好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立使用ASP.NET公共网站,作为交付的一部分,我需要做的在公共网站上显示的东西,数据录入的管理网站,我想知道的技术或程序使用的人来验证什么使用ASP.NET MVC的条目。

I am building a public website using ASP.NET, as part of the deliverable I need to do an Admin Site for data entry of the stuff shown in the public site, I was wondering what techniques or procedures are people using to validate entries using ASP.NET MVC.

推荐答案

jQuery验证插件这个插件是惊人的,它的清洁来实现,并拥有所有你所能需要的功能,包括通过AJAX的远程验证。

Take a look at the JQuery Validation plugin this plugin is amazing,it's clean to implement and has all the features you could ever need, including remote validation via AJAX.

另外一个样品的MVC控制器的方法可发现这里基本上使用JsonResult动作类型一样:

Also a sample MVC controller method can be found here which basically uses the JsonResult action type like:

public JsonResult CheckUserName(string username)
{
    return Json(CheckValidUsername(username));
}

这篇关于什么是使用ASP.NET MVC实现字段验证的最好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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