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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

MVC拼接前台页面

發(fā)布時間:2025/3/20 c/c++ 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MVC拼接前台页面 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

MVC拼接前臺頁面


? ? ? ? ? MVC的頁面中,有多個相同類型的組件,但是其中的數(shù)據(jù)值不同,而且個數(shù)也是未知的,如圖



? ? ? ? ??

? ? ? ? ??這里使用的是@Html.Raw(ViewBag.Message)

? ? ? ? ??在頁面中的適當(dāng)?shù)奈恢?#xff0c;寫該代碼即可



? ? ? ? ??后臺,Controller中還是利用的MVC的機制,返回頁面的時候,連帶拼接的字符串一塊返回。 ? ?

public ActionResult Index(){//獲取試題IDstring Num =Request.QueryString["Num"];//獲取所有的審批,按時間排序List<QueryResultViewModel>Info = QueryAllType(Num);//獲取審批個數(shù)int Number = Info.Count;//初始化strHTMLStringBuilder strRadioBtn = newStringBuilder();//循環(huán)遍歷,動態(tài)拼接for (int i = 0; i < Number;i++){strRadioBtn.Append("<div class=\"panel panel-default\"style=\"width:1075px; margin-left:10px;\">");strRadioBtn.Append("<div class=\"panel-heading\">審批類型—" + Info[i].departmentName + "<spanstyle=\"margin-left:820px\">狀態(tài):"+ Info[i].accumulateStates + "</span>" +"</div>");strRadioBtn.Append("<div class=\"panel-body\">");strRadioBtn.Append("<div>");strRadioBtn.Append("<span >用戶名:"+Info[i].userName+"</span>");strRadioBtn.Append("</div>");strRadioBtn.Append("<div style=\"float:left;margin-left:820px;margin-top:-20px;\">");strRadioBtn.Append("<span >上傳日期:"+Info[i].date+"</span><br>");strRadioBtn.Append("</div>");strRadioBtn.Append("<span >審批內(nèi)容:"+Info[i].accumulateDescription+"</span><br>");strRadioBtn.Append("<span >回復(fù)內(nèi)容:"+Info[i].operaterResponse+"</span><br>");strRadioBtn.Append("<div>");strRadioBtn.Append("<span >審批人:"+Info[i].operaterName+"</span>");strRadioBtn.Append("</div>");strRadioBtn.Append("<divstyle=\"float:left;margin-left:820px;margin-top:-20px;\">");strRadioBtn.Append("<span >審批日期:"+ Info[i].operaterDate + "</span>");strRadioBtn.Append("</div>");strRadioBtn.Append("</div>");strRadioBtn.Append("</div>");}//返回頁面ViewBag.Message = strRadioBtn;returnView("ResultInfo");}


總結(jié)

以上是生活随笔為你收集整理的MVC拼接前台页面的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

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