View和View的参数传递
来源:互联网 发布:济南seo小武 编辑:程序博客网 时间:2024/06/09 14:52
View和View的参数传递
在做ITOO的过程中,遇到了一个问题,就是页面和页面之间跳转参数传递的问题。
这里前台使用的是easyUI的组件,第一个页面查看考生登录情况,其中有一个详情,点击之后,会跳转到第二个页面。
第二个页面需要第一个页面的一些参数,你所选的该行的各个参数,考试、考场、考试日期和时间等等,查询并显示该场考试,这个考场的考生详细信息。
第一个页面
第二个页面
这里在第一个View中使用的js,通过调用Controller中的一个方法,把第一个页面中的参数传到Controller中,具体代码如下:
<span style="font-size:24px;"><script type="text/javascript"> //在"操作"一列中添加超链接.-编辑考核项目 function rowformater(value, row, index) { return '<a href="/Monitore/MonitoreDetails?ExamID=' + row.ExamID + '&ExamPlaceID=' + row.ExamPlaceID + '&StartDate=' + row.StartDate + '&StartTime=' + row.StartTime + '">详情</a>' return; } </script></span>
然后,在Controller中写一个方法用来接收传递过来的参数,再返回到第二个页面,这里使用的是ViewData。
<span style="font-size:24px;">public ActionResult MonitoreDetails() { //从第一个页面得到相关的参数,传给第二个页面 string ExamID = Request.QueryString["ExamID"]; string ExamPlaceID = Request.QueryString["ExamPlaceID"]; string StartDate = Request.QueryString["StartDate"]; string StartTime = Request.QueryString["StartTime"]; ViewData["ExamID"] = ExamID; ViewData["ExamPlaceID"] = ExamPlaceID; ViewData["StartDate"] = StartDate; ViewData["StartTime"] = StartTime; return View(); }</span>
最后,就是第二个页面接收这些参数,通过这些参数去查询数据库,得到想要的信息显示在表格中。
<span style="font-size:24px;"><table id="Chapter1" title="考生登录情况" class="easyui-datagrid" style="width:1160px; height: 400px;" idfield="itemid" pagination="true" data-options="rownumbers:true,url:'/Monitore/QueryMonitoreDetails?ExamID=@ViewData["ExamID"]&ExamPlaceID=@ViewData["ExamPlaceID"]&StartDate=@ViewData["StartDate"]&StartTime=@ViewData["StartTime"]',pageSize:5, pageList:[10,20,30,40],method:'get',toolbar:'#tb',striped:true" fitcolumns="true"> <thead> <tr> <th data-options="field:'StudentNo',width:100">学号</th> <th data-options="field:'StudentName',width:100">姓名</th> <th data-options="field:'State',width:100">状态</th> @*<th data-options="field:'IP',width:100">IP</th>*@ <th data-options="field:'Colleage',width:100">学院</th> <th data-options="field:'Major',width:100">专业</th> </tr> </thead> </table></span>
0 0
- View和View的参数传递
- View和View的参数传递二
- iPhone view 之间的参数传递
- Android自定义View传递参数
- Android ViewGroup和View的传递事件
- ViewGroup和View的事件传递原理
- View的事件传递
- view的事件传递
- View的事件传递
- View事件的传递
- View的位置参数
- view的位置参数:
- View 的位置参数
- View的位置参数
- View的位置参数
- View 的位置参数
- View的位置参数
- IPHONE开发 在VIEW之间传递参数
- 深入简单Java类与数据表之间多对多映射
- XZ_iOS之UITableView的代理方法的执行顺序
- 安卓入门-UI Components 之Menu (菜单)
- 回文字符 Linux下编程
- 不小心删除PowerDesigner里面的一个小工具,怎么恢复
- View和View的参数传递
- HTTP头域列表与解释 之 request篇
- 深入简单Java类(一对多映射
- Win7系统安装MySQL5.5.21图解教程
- Java源码-字符串大小比较(Comparing Strings)
- FastJson:常规使用,积少成多:
- 梳理caffe代码loss(二十二)
- 简单Java类多对多映射
- 如何实现定时执行php的程序