调用: 视图调用: 1 @Html.DropDownListFor(t => t.HrEmpGuid, ViewData["Emp"] as SelectList, new { @class = "form-control select2" }) 1 @Html.DropDownListFor(t ...
分类:
Web程序 时间:
2017-08-13 23:22:34
阅读次数:
259
<1> 控制器 </pre><pre name="code" class="csharp">using MvcTest.Models; using System; using System.Collections.Generic; using System.Linq; using System.We ...
分类:
Web程序 时间:
2017-08-06 20:56:02
阅读次数:
267
Upload Form load->helper(array('form', 'url')); } public function index() { $this->_viewData['title'] = "test"; $this->_viewData['... ...
分类:
Web程序 时间:
2017-07-15 17:52:05
阅读次数:
243
_viewData['__hash__'] = $hash; parent::index(); } public function do_submit() { $data = $this->input->post(); if(empty($data['__hash__'])){ echo "hack... ...
分类:
Web程序 时间:
2017-07-12 16:13:29
阅读次数:
236
1、在过滤器中,不能使用ViewBag类似的东西,这些是Controller中的。 2、Controller中自己定义的非Action方法中(包括构造方法),使用不了Session,这时获取不到Session。可以使用ViewData、ViewBag存数据。 3、权限验证及菜单读取 我想在BaseC ...
分类:
Web程序 时间:
2017-07-01 11:01:01
阅读次数:
247
背景:MVC框架,页面使用razor语法,下拉框的话使用了@Html.DropDownList(),以前传值使用viewdata,但是我们老大说这个方式比较low,希望我可以使用viewmodel的方式,没问题,我来改,首先建立viewmodel,把列表数据传入vm,把多个下拉的数据通过vm传递。 ...
分类:
其他好文 时间:
2017-06-23 16:25:12
阅读次数:
205
*一般在MVC中,aspx后台要往前台传递参数,使用ViewData["Key"] = obj; 前台就要 <%=(ViewData["key"] as ClassName).xxx属性%> 这个的坏处是,如果key的名字改了,前台就不能获取数据,而且在编译阶段查不出错误,所以,可以改成如下写法: ...
分类:
Web程序 时间:
2017-06-09 15:19:32
阅读次数:
289
*最普通的交互方式,在Contoller中的Action方法内 public ActionResult Index() { ViewData["Key"] =Value; Return View(); } *对应Action的前台页面,在前台的Index.aspx中,即可使用<%=ViewData[ ...
分类:
Web程序 时间:
2017-06-09 14:11:03
阅读次数:
221
1.ViewData:C传递数据到V中:ViewData["studentList"]=studentList; V接收C传来的数据:var stu=(Student)ViewData["studentList"]; 2.ViewBag:C >V:ViewBag._product=p; 接收:var ...
分类:
Web程序 时间:
2017-06-09 00:52:55
阅读次数:
205
首先在需要分页的table 下引入这行代码(引入已经准备好的通用分页) @Html.Partial("~/Views/Shared/_Pagination.js.cshtml",ViewData) 只需要在控制器设置两个参数 public ActionResult ProjectNode(strin ...
分类:
其他好文 时间:
2017-06-07 18:42:57
阅读次数:
261