http://deanhume.com/Home/BlogPost/mvc-3-and-remote-validation/51 <----
http://davidhayden.com/blog/dave/archive/2011/01/04/ASPNETMVC3RemoteValidationTutorial.aspx <----
http://www.cnblogs.com/serafin/archive/2011/01/25/1944848.html
public
ActionResult CheckUserAccountExists(
string
UserAccount)
{
string
[] existsUsers = {
"youguanbumen"
,
"wodanwojun"
};
bool
exists =
string
.IsNullOrEmpty(existsUsers.FirstOrDefault(u => u.ToLower() == UserAccount.ToLower())) ==
false
;
return
Json(!exists, JsonRequestBehavior.AllowGet);
}
-------------------------------------------------------------------------------
public ActionResult TagExists(string Name)
{
var tag = TagRepository.FindAll().Where(i => i.Name == Name).Count();
return Json(tag==0, JsonRequestBehavior.AllowGet);
}
MVC 3.0 Remote Validata
转载下一篇:浅谈URL生成方式的演变
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
MVC 3.0 搞笑网站
Suhow.com致力于打造网络最精选搞笑站点,技术支持ASP.NET MVC 3.0 + EF 4.0,欢迎广大网友登临,在研究技术之余,看看搞笑,调整心情,快乐每一天。
.NET IT C# WEB MVC Jquery