日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

View和View的参数传递二

發(fā)布時(shí)間:2025/3/20 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 View和View的参数传递二 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

View和View的參數(shù)傳遞二


? ? ? ? ? 在做ITOO的時(shí)候,有一個(gè)需求,就是考生登錄情況的模糊查詢功能,用到了第一個(gè)頁(yè)面中的參數(shù),但是,這里的模糊查詢事件是在第二個(gè)頁(yè)面中觸發(fā)的。

? ? ? ? ??解決辦法

? ? ? ? ??首先,第一個(gè)頁(yè)面在跳轉(zhuǎn)到第二個(gè)頁(yè)面的時(shí)候,進(jìn)行參數(shù)的傳遞,把用到的參數(shù)傳遞給Controller,然后,使用ViewData從Controller返回到第二個(gè)頁(yè)面。

? ? ? ? ??第一個(gè)頁(yè)面

<span style="font-size:24px;"><script type="text/javascript">//在"操作"一列中添加超鏈接.-編輯考核項(xiàng)目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

<span style="font-size:24px;">public ActionResult MonitoreDetails(){//從監(jiān)測(cè)界面拿到相關(guān)信息,查詢具體學(xué)生信息-趙寒-2016-5-7string 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>

? ? ? ? ??在第二頁(yè)面中,使用隱藏的控件來接收這些參數(shù)。

<span style="font-size:24px;"><input id="ExamID" value=@ViewData["ExamID"] hidden /><input id="ExamPlaceID" value=@ViewData["ExamPlaceID"] hidden /><input id="StartDate" value=@ViewData["StartDate"] hidden /><input id="StartTime" value=@ViewData["StartTime"] hidden /></span>

? ? ? ? ??此時(shí),這些參數(shù)就有了,使用js進(jìn)行模糊查詢的時(shí)候,直接使用即可。


<span style="font-size:24px;"><script>@*模糊查詢的js——?jiǎng)⑸黉h——2016-8-3 15:55:29*@function doSearch(value, name) {var ExamID = $('#ExamID').val();var ExamPlaceID = $('#ExamPlaceID').val();var StartDate = $('#StartDate').val();var StartTime = $('#StartTime').val();$('#Chapter1').datagrid({url: '/Monitore/FuzzyQueryStudentInfo?strLike=' + value + "&ExamID=" + ExamID + "&ExamPlaceID=" + ExamPlaceID + "&StartDate=" + StartDate + "&StartTime=" + StartTime});$("#Chapter1").datagrid("reload");//重新加載表信息datagrid}</script></span>

總結(jié)

以上是生活随笔為你收集整理的View和View的参数传递二的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。