MVC3快速搭建Web应用(二)

开发 前端
Web应用不像winform应用,要想让用户得到更流畅更舒适的体验,方法之一就是模拟winform的窗口操作,使用户在浏览器中也能像桌面一样舒服。

上一篇文章发布后MVC3快速搭建Web应用(一),自己又仔细读了数遍,感觉一是文笔太差,二是描述逻辑比较混乱,客观原因是涉及到东西其实蛮多的,那三个步骤不可能在一篇短短的文章中就可以描述清楚。此篇笔者将尽量更加详尽一些。另外需要说明一点的是,本文默认读者:

熟悉ASP.NET MVC;Razor语法;熟悉javascript;实体框架。

Web应用不像winform应用,要想让用户得到更流畅更舒适的体验,方法之一就是模拟winform的窗口操作,使用户在浏览器中也能像桌面一样舒服。在界面框架方面我们有大家最熟悉的jquery ui,有Ext等等,经过一系列的筛选,我们最终决定使用easyui,文档教程例子都比较全面的一个js ui框架。首先我们来看看用到的js文件

  1. <script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script> jquery主文件  
  2. <script src="@Url.Content("~/Scripts/jquery.easyui.min.js")" type="text/javascript"></script> easy ui主文件  
  3. <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> 校验组件   
  4. <script src="@Url.Content("~/Scripts/jquery.form.js")" type="text/javascript"></script> 表单组件  
  5. <script src="@Url.Content("~/Scripts/easyui-lang-zh_CN.js")" type="text/javascript"></script> easyui的中文化  
  6. <script src="@Url.Content("~/Scripts/messages_cn.js")" type="text/javascript"></script> 校验组件的中文化 

我们把它添加到mvc的Shared/_Layout.cshtml中。这样我们的项目所有Layout=null的视图都拥有了easyui支持。

在MVC3中,当你右键添加一个控制器时,向导会让你选择:

其中模版我们选择使用实体框架并生成相关actions与views,Model选择你实体框架中对应的表名(类名),DataContext选择上下文类

Views引擎选择Razor,高级选项里的两个勾都去掉,因为我们不需要引用内置的脚本库,也不需要选择layout(不选择layout,MVC默认该view使用Shared/_Layout.cshtml,也就是刚才我们添加js文件link的那个文件)。

确认上一篇中你下载的t4模版放进了它应该存在的地方(最好备份一下原始的),当你点击Add时,vs会自动在Controllers下面添加相应的控制器,在views文件夹下添加Create、Edit、Delete、Details、Index五个文件。下面我们一一查看他们的内容:

#p#

控制器中,action已经自动帮你添加完毕

  1.     private BsmisEntities db = new BsmisEntities();  
  2.         //  
  3.         // GET: /User/  
  4.  
  5.         public ViewResult Index()  
  6.         {  
  7.             return View();  
  8.         }  
  9.  
  10.         //  
  11.         // GET: /User/Create  
  12.         public ActionResult Create()  
  13.         {  
  14.             return View();  
  15.         }   
  16.  
  17.         //  
  18.         // POST: /User/Create  
  19.         [HttpPost]  
  20.         public ActionResult Create(T_User t_user)  
  21.         {  
  22.             JsonResult result = new JsonResult();  
  23.             result.Data = true;  
  24.             try 
  25.             {  
  26.  
  27.                 if (t_user.Enable == null)  
  28.                     t_user.Enable = 0;  
  29.  
  30.                 db.T_User.AddObject(t_user);  
  31.  
  32.                 db.SaveChanges();  
  33.             }  
  34.             catch (Exception ee)  
  35.             {  
  36.                 result.Data = ee.Message;  
  37.             }  
  38.             return result;  
  39.         }  
  40.  
  41.         //  
  42.         // GET: /User/Edit/5  
  43.         [OutputCache(Location = OutputCacheLocation.None)]  
  44.         public ActionResult Edit(int id)  
  45.         {  
  46.             T_User t_user = db.T_User.Single(t => t.UserID == id);  
  47.             ViewBag.DepartmentID = new SelectList(db.T_DepartmentInfo, "DepartmentID""Code", t_user.DepartmentID);  
  48.             return View(t_user);  
  49.         }  
  50.  
  51.         //  
  52.         // POST: /User/Edit/5  
  53.  
  54.         [HttpPost]  
  55.         [OutputCache(Location = OutputCacheLocation.None)]  
  56.         public ActionResult Edit(T_User t_user)  
  57.         {  
  58.             JsonResult result = new JsonResult();  
  59.             result.Data = true;  
  60.             try 
  61.             {  
  62.                 db.T_User.Attach(t_user);  
  63.                 db.ObjectStateManager.ChangeObjectState(t_user, EntityState.Modified);  
  64.                 db.SaveChanges();  
  65.             }  
  66.             catch (Exception ee)  
  67.             {  
  68.                 result.Data = ee.Message;  
  69.             }  
  70.             return result;  
  71.  
  72.         }  
  73.  
  74.         //  
  75.         // POST: /User/Delete/5  
  76.         [HttpPost, ActionName("Delete")]  
  77.         public ActionResult DeleteConfirmed(int id)  
  78.         {   
  79.        JsonResult json=new JsonResult();  
  80.         json.Data=true;  
  81.         try 
  82.         {              T_User t_user = db.T_User.Single(t => t.UserID ==id);  
  83.               db.T_User.DeleteObject(t_user);  
  84.               db.SaveChanges();  
  85.         }  
  86.         catch(Exception ee)  
  87.         {  
  88.           json.Data=ee.Message;  
  89.         }  
  90.         return json;        }  
  91.  
  92.  
  93.         /// <summary>  
  94.         /// 数据显示、分页信息  
  95.         /// </summary>  
  96.         /// <param name="page"></param>  
  97.         /// <param name="rows"></param>  
  98.         /// <returns></returns>  
  99.         public JsonResult List(int page, int rows)  
  100.         {  
  101.             var q = from u in db.T_User  
  102.                     join d in db.T_DepartmentInfo on u.DepartmentID equals d.DepartmentID  
  103.                     orderby u.UserID  
  104.                     select new 
  105.                         {  
  106.                             UserID = u.UserID,  
  107.                             UserName = u.UserName,  
  108.                             Address = u.Address,  
  109.                             Birth = u.Birth,  
  110.                             DepartmentID = u.DepartmentID,  
  111.                             DepartmentName = d.Name,  
  112.                             Enable = u.Enable,  
  113.                             Gendar = u.Gendar,  
  114.                             IDCardNumber = u.IDCardNumber,  
  115.                             LastAccessIP = u.LastAccessIP,  
  116.                             LastAccessTime = u.LastAccessTime,  
  117.                             LogonTimes = u.LogonTimes,  
  118.                             Password = u.Password,  
  119.                             PostCode = u.PostCode,  
  120.                             RealName = u.RealName,  
  121.                             Tel = u.Tel,  
  122.                             Province = u.Province,  
  123.                             City = u.City,  
  124.                             Area = u.Area  
  125.                         };  
  126.  
  127.  
  128.             var result = q.Skip((page - 1) * rows).Take(rows).ToList();  
  129.             Dictionary<string, object> json = new Dictionary<string, object>();  
  130.             json.Add("total", q.ToList().Count);  
  131.             json.Add("rows", result);  
  132.  
  133.             return Json(json, JsonRequestBehavior.AllowGet);  
  134.         } 

这些action分别对应create、delete、edit、index视图(detail我们一般情况下不需要它,所以我的模版里没有写对应的生成代码)你可以比较一下它与原生的模版生成的代码之间的区别。后期我们还会在控制器里添加一些譬如检查名称是否重名之类的action

  1. [OutputCache(Location = OutputCacheLocation.None)]  
  2.         public JsonResult CheckRealNameExist(string RealName, int UserID)  
  3.         {  
  4.             JsonResult result = new JsonResult();  
  5.             result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;  
  6.  
  7.             result.Data = false;  
  8.             try 
  9.             {  
  10.                 if (UserID == 0)  
  11.                 {  
  12.                     if (db.T_User.Any(p => p.RealName == RealName))  
  13.                     {  
  14.                         return result;  
  15.                     }  
  16.  
  17.                 }  
  18.                 else 
  19.                 {  
  20.                     if (db.T_User.Any(p => ((p.UserID != UserID) && (p.RealName == RealName))))  
  21.                     {  
  22.                         return result;  
  23.                     }  
  24.                 }  
  25.             }  
  26.             catch (Exception)  
  27.             {  
  28.                 return result;  
  29.             }  
  30.  
  31.             result.Data = true;  
  32.             return result;  
  33.  
  34.         } 

返回值一般都是jsonresult。这样的话,当你在浏览器中访问http://localhost:1233/User/CheckRealNameExist?RealName=张三&UserID=0时 你会获得一个true或false值。是不是跟webservice有点异曲同工?

同样,在Views文件夹中生成了Create、Edit、Details、Delete、Index五个文件,其中Details与Delete我们不需要,因为我们想使用更友好的异步删除(用户单击delete后,页面不刷新,成功后浏览器下方滑出提示,3秒后关闭,失败滑出失败信息,不自动关闭 /利用easyui中的messager组件)。以下是Index中的js:

#p#

  1. //删除  
  2.         function del() {  
  3.             var id = getselectedRow();  
  4.             if (id != undefined) {  
  5.                 $.messager.confirm('确认''确定删除?'function (r) {  
  6.                     if (r) {  
  7.                         var url = 'User/Delete/' + id;  
  8.                         $.post(url, function () {  
  9.  
  10.                         }).success(function () {  
  11.                             $.messager.show({  
  12.                                 title: '提示',  
  13.                                 msg: '删除成功',  
  14.                                 timeout: 3000,  
  15.                                 showType: 'slide' 
  16.                             });  
  17.                             $('#dg').datagrid('reload');  
  18.                         })  
  19.                             .error(function () {  
  20.                                 $.messager.alert('错误''删除发生错误');  
  21.                             });  
  22.  
  23.                     }  
  24.                 });  
  25.             }  
  26.         } 

我们把Details与Delete删除后只剩下Index、Create、Edit三个文件,这三个文件之间的关系是,Index中包含添加、编辑按钮,点击后使用js将对应的actionresult加载到div中,以实现弹窗新建,编辑的效果。

  1. //新建  
  2.         function c_dlg() {  
  3.             var url = 'User/Create';  
  4.             $('#c_dlg').show();  
  5.             $('#c_dlg').load(url, function () {  
  6.                 $(this).dialog({  
  7.                     title: '添加',  
  8.                     buttons: [{  
  9.                         text: '提交',  
  10.                         iconCls: 'icon-ok',  
  11.                         handler: function () {  
  12.                             $('#c_form').submit();  
  13.                         }  
  14.                     }, {  
  15.                         text: '取消',  
  16.                         handler: function () {  
  17.                             $('#c_dlg').dialog('close');  
  18.                         }  
  19.                     }]  
  20.                 });  
  21.             });  
  22.         }  
  23.  
  24.         //编辑框  
  25.         function e_dlg() {  
  26.             var id = getselectedRow();  
  27.             if (id != undefined) {  
  28.                 var url = 'User/Edit/' + id;  
  29.                 $('#e_dlg').show();  
  30.                 $('#e_dlg').load(url, function () {  
  31.                     $(this).dialog({  
  32.                         title: '编辑',  
  33.                         buttons: [{  
  34.                             text: '提交',  
  35.                             iconCls: 'icon-ok',  
  36.                             handler: function () {  
  37.                                 $('#e_form').submit();  
  38.                             }  
  39.                         }, {  
  40.                             text: '取消',  
  41.                             handler: function () {  
  42.                                 $('#e_dlg').dialog('close');  
  43.                             }  
  44.                         }]  
  45.                     });  
  46.                 });  
  47.             }  
  48.         } 

这里面的c_dlg与e_dlg是index页面的两个Div节点:

  1. <div id="c_dlg" style="width:400px;height:520px;display: none"></div> 
  2. <div id="e_dlg" style="width:400px;height:520px;display: none"></div> 

以上的代码完成将控制器中的action返回的页面内容动态加载到div中,并以弹窗的特效显示在当前(Index)页面中。效果如图:

我们来看看Create\Edit视图的内容,首先是js

#p#

  1. <script type="text/javascript">  
  2.     $(function () {  
  3.         $('#c_Department').combotree({  
  4.             url: '@Url.Action("GetComboTreeJson","Department")' 
  5.         });  
  6.         $('#c_City').combobox();  
  7.         $('#c_Area').combobox();  
  8.           
  9.         $('#c_Province').combobox({ url:'CityDic/List/ID/0',  
  10.             onSelect: function (record) {  
  11.                 $('#c_City').combobox('reload''CityDic/List/ID/' + record.ID).combobox('clear');  
  12.                 $('#c_Area').combobox('clear');  
  13.             }  
  14.         });  
  15.  
  16.         $('#c_City').combobox({  
  17.             onSelect: function (record) {  
  18.                 $('#c_Area').combobox('reload''CityDic/List/ID/' + record.ID).combobox('clear');  
  19.             }  
  20.         });  
  21.           
  22.         $('#c_Birth').datebox().datebox('setValue''@now');  
  23.           
  24.         $("#c_form").validate({  
  25.             rules: {  
  26.                 UserName: {  
  27.                     required: true,  
  28.                     remote:  
  29.                         {  
  30.                             url: 'User/CheckNameExist',  
  31.                             type: "get",  
  32.                             dataType: "json",  
  33.                             data: {  
  34.                                 Name: function () { return $('#c_UserName').val(); },  
  35.                                 UserID: function () { return 0; }  
  36.                             }  
  37.                         }  
  38.                 },  
  39.                 RealName: {  
  40.                     required:true,  
  41.                     remote: {  
  42.                         url: 'User/CheckRealNameExist',  
  43.                         type: "get",  
  44.                         dataType: "json",  
  45.                         data: {  
  46.                             RealName: function () { return $('#c_RealName').val(); },  
  47.                             UserID: function () { return 0; }  
  48.                         }  
  49.                     }  
  50.                 }  
  51.             },  
  52.             messages: {  
  53.                 UserName: {  
  54.                     remote: '名称重复' 
  55.                 },   
  56.                 RealName: { remote: '名称重复' }  
  57.             },  
  58.             submitHandler: function (form) {  
  59.                 ajaxAdd();  
  60.             }  
  61.         });  
  62.     });  
  63. </script> 

这部分js将本页面的控件初始化为对应的下拉框或日期选取框等等,Html为

  1. @using (Html.BeginForm("Create", "User", FormMethod.Post, new { id = "c_form" }))  
  2. {  
  3.  <fieldset> 
  4.         <table class="editForm"> 
  5.             <tr> 
  6.                 <td> 
  7.                     @Html.LabelFor(model => model.UserName, "用户名:")  
  8.                 </td> 
  9.                 <td> 
  10.                       
  11.                    <input id="c_UserName" name="UserName" style="width: 160px;" required="true" /><span style="color: red"> 
  12.                         *</span> 
  13.                 </td> 
  14.             </tr> 
  15.             <tr> 
  16.                 <td> 
  17.                     @Html.LabelFor(model => model.DepartmentID, "组织机构:")  
  18.                 </td> 
  19.                 <td> 
  20.                     <input id="c_Department" name="DepartmentID" style="width: 160px;" required="true" /><span style="color: red"> 
  21.                         *</span> 
  22.                 </td> 
  23.             </tr> 
  24.             <tr> 
  25.                 <td> 
  26.                     @Html.LabelFor(model => model.Password, "密码:")  
  27.                 </td> 
  28.                 <td> 
  29.                     @Html.PasswordFor(model => model.Password, new { @class = "{required:true,minlength:5}" })<span style="color: red"> 
  30.                         *</span> 
  31.                 </td> 
  32.             </tr> 
  33.             <tr> 
  34.                 <td> 
  35.                     <label for="confirm_password"> 
  36.                         确认密码</label> 
  37.                 </td> 
  38.                 <td> 
  39.                     <input id="confirm_password" name="confirm_password" type="password" class="{required:true,minlength:5,equalTo:'#Password'}" /><span style="color: red"> 
  40.                         *</span> 
  41.                 </td> 
  42.             </tr> 
  43.             <tr> 
  44.                 <td> 
  45.                     @Html.LabelFor(model => model.RealName, "真实姓名:")  
  46.                 </td> 
  47.                 <td> 
  48.                     @Html.TextBoxFor(model => model.RealName, new { @id="c_RealName",@class = "{required:true}" })<span style="color: red"> 
  49.                         *</span> 
  50.                 </td> 
  51.             </tr> 
  52.             <tr> 
  53.                 <td> 
  54.                     @Html.LabelFor(model => model.Gendar, "性别:")  
  55.                 </td> 
  56.                 <td> 
  57.                     @Html.RadioButtonFor(model => model.Gendar, "男", new { @id = "radio1", @name = "Gendar", @checked = "checked" })  
  58.                     <label for="radio1"> 
  59.                         男</label> 
  60.                     @Html.RadioButtonFor(model => model.Gendar, "女", new { @id = "radio2", @name = "Gendar" })  
  61.                     <label for="radio2"> 
  62.                         女</label> 
  63.                 </td> 
  64.             </tr> 
  65.             <tr> 
  66.                 <td> 
  67.                     @Html.LabelFor(model => model.Birth, "出生日期:")  
  68.                 </td> 
  69.                 <td> 
  70.                     <input id="c_Birth" required="true" name="Birth" /> 
  71.                 </td> 
  72.             </tr> 
  73.             <tr> 
  74.                 <td> 
  75.                     @Html.LabelFor(model => model.IDCardNumber, "身份证号码:")  
  76.                 </td> 
  77.                 <td> 
  78.                     @Html.EditorFor(model => model.IDCardNumber)  
  79.                 </td> 
  80.             </tr> 
  81.             <tr> 
  82.                 <td> 
  83.                     @Html.LabelFor(model => model.Province, "省份:")  
  84.                 </td> 
  85.                 <td> 
  86.                     <input name="Province" valuefield="Name" textfield="Name" panelheight="auto" id="c_Province" style="width: 150px"> 
  87.                 </td> 
  88.             </tr> 
  89.             <tr> 
  90.                 <td> 
  91.                     @Html.LabelFor(model => model.City, "市:")  
  92.                 </td> 
  93.                 <td> 
  94.                     <input name="City" valuefield="Name" textfield="Name" panelheight="auto" id="c_City" style="width:150px"> 
  95.                 </td> 
  96.             </tr> 
  97.             <tr> 
  98.                 <td> 
  99.                     @Html.LabelFor(model => model.Area, "区/县:")  
  100.                 </td> 
  101.                 <td> 
  102.                     <input name="Area" valuefield="Name" textfield="Name" panelheight="auto" id="c_Area" style="width: 150px"> 
  103.                 </td> 
  104.             </tr> 
  105.             <tr> 
  106.                 <td> 
  107.                     @Html.LabelFor(model => model.PostCode, "邮政编码:")  
  108.                 </td> 
  109.                 <td> 
  110.                     @Html.EditorFor(model => model.PostCode)  
  111.                 </td> 
  112.             </tr> 
  113.             <tr> 
  114.                 <td> 
  115.                     @Html.LabelFor(model => model.Address, "地址:")  
  116.                 </td> 
  117.                 <td> 
  118.                     @Html.EditorFor(model => model.Address)  
  119.                 </td> 
  120.             </tr> 
  121.             <tr> 
  122.                 <td> 
  123.                     @Html.LabelFor(model => model.Tel, "电话:")  
  124.                 </td> 
  125.                 <td> 
  126.                     @Html.EditorFor(model => model.Tel)  
  127.                 </td> 
  128.             </tr> 
  129.             <tr> 
  130.                 <td> 
  131.                     @Html.LabelFor(model => model.Enable, "启用:")  
  132.                 </td> 
  133.                 <td> 
  134.                     @Html.CheckBoxForBool(model=>model.Enable,true,true)  
  135.                 </td> 
  136.             </tr> 
  137.         </table> 
  138.     </fieldset> 

编辑视图中也类似如此。当单击保存按钮后,执行

  1. $('#c_form').submit(); 

#p#

这里我们的客户端校验在这里:

  1. $("#c_form").validate({  
  2.             rules: {  
  3.                 UserName: {  
  4.                     required: true,  
  5.                     remote:  
  6.                         {  
  7.                             url: 'User/CheckNameExist',  
  8.                             type: "get",  
  9.                             dataType: "json",  
  10.                             data: {  
  11.                                 Name: function () { return $('#c_UserName').val(); },  
  12.                                 UserID: function () { return 0; }  
  13.                             }  
  14.                         }  
  15.                 },  
  16.                 RealName: {  
  17.                     required:true,  
  18.                     remote: {  
  19.                         url: 'User/CheckRealNameExist',  
  20.                         type: "get",  
  21.                         dataType: "json",  
  22.                         data: {  
  23.                             RealName: function () { return $('#c_RealName').val(); },  
  24.                             UserID: function () { return 0; }  
  25.                         }  
  26.                     }  
  27.                 }  
  28.             },  
  29.             messages: {  
  30.                 UserName: {  
  31.                     remote: '名称重复' 
  32.                 },   
  33.                 RealName: { remote: '名称重复' }  
  34.             },  
  35.             submitHandler: function (form) {  
  36.                 ajaxAdd();  
  37.             }  
  38.         }); 

submitHandler方法提供校验前要做的事情:ajaxAdd()

  1. //异步新建提交  
  2.         function ajaxAdd() {  
  3.             $('#c_form').ajaxSubmit({  
  4.                 url: 'User/Create',  
  5.                 beforeSubmit: function () {  
  6.                     if ($('#c_form').form('validate') != true) {  
  7.                         return false;  
  8.                     }  
  9.                     if ($("#c_form").valid() != true) {  
  10.                         return false;  
  11.                     }  
  12.                     return true;  
  13.                 },  
  14.                 success: function (data) {  
  15.                     if (data == true) {  
  16.                         $('#c_dlg').dialog('close');  
  17.                         $('#dg').datagrid('reload');  
  18.                         $.messager.show({  
  19.                             title: '提示',  
  20.                             msg: '保存成功',  
  21.                             timeout: 2000,  
  22.                             showType: 'slide' 
  23.                         });  
  24.                     } else {  
  25.                         $.messager.show({  
  26.                             title: '提示',  
  27.                             msg: '保存失败:' + data,  
  28.                             timeout: 2000,  
  29.                             showType: 'slide' 
  30.                         });  
  31.                     }  
  32.                 }  
  33.             });  
  34.  
  35.             return false;  
  36.         } 

异步提交成功后获取data,如果是true说明成功了,关闭“对话框”,刷新表格,弹出提示。失败的话将data弹出(一般是失败原因,由controller中的action返回)。下面是Index中的表格:

  1. <table id="dg" class="easyui-datagrid"   
  2.            toolbar="#toolbar"    
  3.            rownumbers="true" fitColumns="true" singleSelect="true" pagination="true" fit="true"> 
  4.         <thead>      
  5.             <tr> 
  6.                 <th field="DepartmentName" width="80"> 
  7.                     部门  
  8.                 </th> 
  9.                 <th field="UserName" width="100"> 
  10.                     用户名  
  11.                 </th> 
  12.                 <th field="RealName" width="100"> 
  13.                     真实姓名  
  14.                 </th> 
  15.                 <th field="Gendar" width="30"> 
  16.                     性别  
  17.                 </th> 
  18.                 <th field="Birth" width="70" formatter="formatDate"> 
  19.                     生日  
  20.                 </th> 
  21.                 <th field="Tel" width="50"> 
  22.                     电话  
  23.                 </th> 
  24.                 <th field="LogonTimes" width="50"> 
  25.                     登陆次数  
  26.                 </th> 
  27.                 <th field="LastAccessIP" width="120"> 
  28.                     最后访问IP  
  29.                 </th> 
  30.                 <th field="LastAccessTime" width="50"> 
  31.                     最后访问时间  
  32.                 </th> 
  33.                 <th field="Enable" width="50" formatter="formatBool"> 
  34.                     状态  
  35.                 </th> 
  36.             </tr> 
  37.         </thead> 
  38.     </table> 
  39.     <div id="toolbar"> 
  40.         @if (userid != 0 && AuthMgr.HasAuth(userid, "add", 5))  
  41.         {  
  42.             <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="c_dlg();">添加</a>    
  43.         }  
  44.         @if (userid != 0 && AuthMgr.HasAuth(userid, "edit", 5))  
  45.         {  
  46.             <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="e_dlg()" >编辑</a> 
  47.         }  
  48.     </div> 

其中@if是用来判断权限,如果当前登陆用户拥有add权限,那么就显示“添加“按钮。

今天先写到这。

原文链接:http://www.cnblogs.com/limlee/archive/2012/06/25/rapid_dev_use_mvc_2.html

【编辑推荐】

 

责任编辑:张伟 来源: Geek 狮子的博客
相关推荐

2012-06-23 20:24:33

Web

2012-07-11 23:32:33

MVC3项目

2015-06-23 16:42:21

2012-07-16 13:02:01

2012-03-13 09:11:46

Web

2014-04-16 11:03:36

MVC3JSON

2012-08-27 10:11:43

ASP.NET

2012-03-27 14:34:07

Visual Stud微软MVC

2013-01-10 17:37:22

架构企业级应用架构

2016-08-22 20:37:10

PythonWeb服务器

2009-07-24 11:25:53

Web应用程序工程ASP.NET MVC

2010-06-23 08:56:58

ASP.NET MVC

2012-10-24 14:53:31

IBMdw

2021-01-21 05:49:39

Web开发应用程序

2011-04-15 09:20:56

ASP.NET MVC

2010-11-17 12:59:52

2024-09-29 16:36:16

2011-04-14 09:19:22

ASP.NET MVC

2020-12-25 10:52:28

鸿蒙HarmonyOS应用开发

2011-04-18 09:35:59

ASP.NET MVC
点赞
收藏

51CTO技术栈公众号