博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
查询数据(后台到前台传递数据,显示数据)
阅读量:5113 次
发布时间:2019-06-13

本文共 5880 字,大约阅读时间需要 19 分钟。

前台相关代码:

头部导入代码:

*@@model IDictionary
@{ var fuid = ViewContext.RouteData.Values["id"].GetString(); var list = (PagedList
)Model["list"]; var spaceTeam = (IQueryable
)Model["spaceteam"]; ViewBag.Title = "空间好友表"; ViewBag.ItemMenu = "Home"; Layout = "~/Areas/PersonalSpace/Views/Shared/master/_LayoutIndex.cshtml"; string ViewMode = Request["view"]; string Durl = ViewBag.Durl; if (string.IsNullOrEmpty(ViewMode)) { ViewMode = "list"; } string cId = ""; if (!string.IsNullOrWhiteSpace(Request["cid"])) { cId = Request["cid"]; } string order = Request["order"]; if (string.IsNullOrEmpty(order)) { order = "0"; } string strUserId = ViewBag.UserId; string loginUserId = LoginBLL.GetCurrentUserFid(); ViewData["UserId"] = strUserId;}

 

使用循环调用相关代码:

 

@using (Html.BeginForm())    {        
@*
*@
好友名称:
  
utList = bb.FindALL().Where(temp => temp.FId == fTypeId).ToList(); UserInfo utList = new UserInfo(); // string FUserImgSmall = && utList.Count > 0 --------------- /@friend.FFriendId if (utList != null) {
  • @if (friend.FFriendId != null) { string ImageUrl = String.IsNullOrEmpty(utList.FUserImgSmall) ? "/Images/uploadimg_default.jpg" : utList.FUserImgSmall;
    好友图片
    } else {
    好友图片 }
  • } } } }
    @* *@ @{ foreach (var friend in list) {@*
    *@ var fTypeId = friend.FFriendId; var userId = LoginBLL.GetCurrentUserFid(); using (SpaceFriendBLL bll = new SpaceFriendBLL()) { UserInfoBLL bb = new UserInfoBLL(); // List
    @friend.FFriendName @friend.FTeamId @if (friend.FType != null && (friend.FType.Trim() == "1" || friend.FType.Trim() == "2")) { } else {
    分组   
    } 解除好友关系
    @Html.Pager(list, new PagerOptions { NumericPagerItemCount = 3, ShowMorePagerItems = true, ShowFirstLast = false, PageIndexParameterName = "page", CurrentPagerItemWrapperFormatString = "
    {0}", NumericPagerItemWrapperFormatString = "
    {0}", AlwaysShowFirstLastPageNumber = true }, "PersonalSpace_default", null)
    }

     

     

     

     

     

     

     

    查询数据的后台代码:

    [HttpGet]        [SupportFilter(FCode = "PersonalSpace_SpaceFriend_List")]//判断页面是否有权限,FCode 调用枚举,没有的自己补,格式为:Areas_Controller_Action,例如:Heart_AgrBaseArea_Add        public ActionResult List(string cid, string keyword, string Durl,string pid, int page = 1, int pageSize = 20) //, string keyword        {            IsAuthorityButton("PersonalSpace_SpaceFriend_List");            IDictionary
    dic = new Dictionary
    (); using (UserInfoBLL ubll = new UserInfoBLL()) { // if (ui.FUserTypeId == "6daf56c8571e451ca017aaeb47e70a22")//ui.FRoleId f5450e699b414c9a8dfd3ebf9022d7a1 // SpaceFriend sf = new SpaceFriend(); // string FFriendId = sf.FFriendId; IQueryable
    ui = ubll.FindALL().Where(x => x.FRoleId == pid); // if (ui.FRoleId.Contains("f5450e699b414c9a8dfd3ebf9022d7a1")) if (ui.Equals("f5450e699b414c9a8dfd3ebf9022d7a1")) { // Durl = "/CompanySpace/SpaceFriend/List"; Durl = "personal/Home/Home/Index"; //personal/Home/Home/Index /CompanySpace/Home/Index } else { // Durl = "/Personal/Space/SpaceFriend/List"; //personal/Home/Home/Index /CompanySpace/Home/Index Durl = "/Personal/Home/Home/Index"; } ViewBag.Durl = Durl; } // var pageList = list.Skip((page - 1) * pageSize).Take(pageSize).ToList(); // var pageList2 = new PagedList
    (pageList, page, pageSize, pageList.Count()); var result = bll.GetSelSpaceFriends(CurrentUser.FId, cid, keyword).AsQueryable
    ().ToPagedList(page, 5);//, keyword // ViewBag.did = did; using (SpaceTeamBLL teambll = new SpaceTeamBLL()) { dic.Add("list", result); using (SpaceTeamBLL teambl = new SpaceTeamBLL()) { IQueryable
    team = teambll.FindALL().Where(x => x.FUserId == CurrentUser.FId); dic.Add("spaceteam", team); } return PartialView(dic);// View(dic); } }

     

    转载于:https://www.cnblogs.com/softmans/p/3303158.html

    你可能感兴趣的文章
    红黑树 c++ 实现
    查看>>
    Android 获取网络链接类型
    查看>>
    linux中启动与终止lnmp的脚本
    查看>>
    gdb中信号的处理[转]
    查看>>
    LeetCode【709. 转换成小写字母】
    查看>>
    如何在Access2007中使用日期类型查询数据
    查看>>
    Jzoj4757 树上摩托
    查看>>
    CF992E Nastya and King-Shamans(线段树二分+思维)
    查看>>
    第一个Java Web程序
    查看>>
    树状数组_一维
    查看>>
    如果没有按照正常的先装iis后装.net的顺序,可以使用此命令重新注册一下:
    查看>>
    linux install ftp server
    查看>>
    嵌入式软件设计第8次实验报告
    查看>>
    算法和数据结构(三)
    查看>>
    Ubuntu下的eclipse安装subclipse遇到没有javahl的问题...(2天解决了)
    查看>>
    alter database databasename set single_user with rollback IMMEDIATE 不成功问题
    查看>>
    Repeater + Resources 列表 [原创][分享]
    查看>>
    WCF揭秘——使用AJAX+WCF服务进行页面开发
    查看>>
    【题解】青蛙的约会
    查看>>
    IO流
    查看>>