首页 > Web开发 > 详细

mvc 客户端验证

时间:2014-05-22 14:48:05      阅读:389      评论:0      收藏:0      [点我收藏+]

@model MvcApplication1.Models.ViewClass
@{
ViewBag.Title = "View2";
}
@******引用这两个js实现客户端的验证 ********@
<script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>

<hr />

viewdata无法跨控制传值
ViewData:
@ViewData["View1"]
<hr />
TempData可以跨一次控制进行传值
@TempData["View3"]
<h2>View2</h2>

<div >
@Html.ValidationSummary(true)
@using (@Html.BeginForm())
{
<div >
@Html.LabelFor(m=>m .Name)
@Html.EditorFor(m=>m.Name)
@Html.ValidationMessageFor(m=>m .Name)
</div>

<div >
@Html.LabelFor(m=>m.Age)
@Html.EditorFor(m=>m .Age)
@Html.ValidationMessageFor(m=>m .Age)
</div>

<div >
@Html.LabelFor(m=>m .Address)
@Html.EditorFor(m=>m .Address)
@Html.ValidationMessageFor(m=>m .Address)

</div>
<input type ="submit" value="提交" />
<div >
<span></span>
</div>
}

</div>

mvc 客户端验证,布布扣,bubuko.com

mvc 客户端验证

原文:http://www.cnblogs.com/sumg/p/3744806.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!