asp.net mvc4 远程验证
[HttpGet]
public ActionResult CheckToolsIdExists(string ToolsID)
{
using (BaseContext context = new BaseContext("ToolsTB"))
{
var isExists = context.T_ToolsSet.FirstOrDefault(m => m.ToolsID == ToolsID);
if (isExists != null)
{
return Json(false, JsonRequestBehavior.AllowGet);
}
return Json(true, JsonRequestBehavior.AllowGet);
}
}
[Remote("CheckToolsIdExists", "SystemManagement",ErrorMessage = "伺服机编号已存在!")]
[Required(ErrorMessage = "*编号不能为空!")]
public string ToolsID { get; set; }
<script src="~/Scripts/jquery-1.7.1.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
<tr>
<td width="120" align="right">拧紧机编号:</td>
<td>@Html.TextBoxFor(m => m.ToolsID, new { @class = "txt", }) @Html.ValidationMessageFor(m => m.ToolsID)</td>
</tr>
最新文章
- tornado template
- Android中锁定文件的方法
- weblogic配置数据源
- 小议jQuery插件开发
- Github上十大C#开源项目排行榜
- 字符串中带有emoji表情处理
- transform实现的时钟效果
- android ScrollView滚动距离和判断滚动停止状态
- iOS - UIButton
- 锋利的jQuery之事件
- 函数lock_rec_create
- 无法解析的外部符号 _WinMain@16 fatal error LNK1120: 1 个无法解析的外部命令
- Pyhon安装media模块
- 使用 gridfs-stream 存储文件遇到的一个坑。
- 解决author波浪线Spellchecker inspection helps locate typos and misspelling in your code, comments and literals, and fix them in one click
- OpenCV设置摄像头分辨率及全屏显示
- Linux动态链接库的生成和使用
- OutOfMemoryError 到底能不能被捕获?
- webpack点滴
- 2.scrapy安装