zoukankan      html  css  js  c++  java
  • partialview 用法

    using  MvcApplication1.Models;

    @model MvcApplication1.Models.UserInfoModel

    @{     ViewBag.Title = "Index";     Layout = "~/Views/Shared/Admin.cshtml"; }

    <h2>Index</h2>

    @*@Html.Partial("UserListPartial")

    @Html.Partial("UserListPartial",1)*@

    @Html.Partial("UserListPartial",@Model.UserList) @*

    @Html.RenderPartial("UserListPartial")*@

    @{         //用html.Partial调用的后台代码         

        //public ActionResult Index()     

        //{         //    TestMVC.Msg.UserDB userdb = new TestMVC.Msg.UserDB(ConfigurationManager.ConnectionStrings["TestMvcConnectionString"].ToString());      

       //    UserInfoModel userInfoModel = new UserInfoModel();

            //    userInfoModel.UserList = new List<Models.UserDetail>();   

          //    DataSet ds = userdb.GetAll();    

         //    if (ds != null && ds.Tables[0].Rows.Count > 0)       

      //    {         //        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)        

    //        {         //            Models.UserDetail userDetail = new Models.UserDetail();        

    //            userDetail.UserID = ds.Tables[0].Rows[i]["UserID"].ToString();        

    //            userDetail.UserName = ds.Tables[0].Rows[i]["UserName"].ToString();        

    //            userDetail.Sex = ds.Tables[0].Rows[i]["Sex"].ToString();        

    //            userDetail.BirthDay = ds.Tables[0].Rows[i]["BirthDay"].ToString();        

    //            userDetail.Emalil = ds.Tables[0].Rows[i]["Emalil"].ToString();        

    //            userDetail.Addr1 = ds.Tables[0].Rows[i]["Addr1"].ToString();       

      //            userDetail.Addr2 = ds.Tables[0].Rows[i]["Addr2"].ToString();        

    //            userInfoModel.UserList.Add(userDetail);         //        }

        //    }

      //    return View(userInfoModel);         //}

            //public ActionResult UserListPartial()  

           //{         //    return PartialView();         //}

       }

    @*    服务器端代码 ,用action的调用方法

    @Html.Action("NonCameraImagePartialView")

    @{Html.RenderAction("NonCameraImagePartialView", new { notIntNo =1 });}

       public ActionResult NonCameraImagePartialView(int notIntNo)  

           {             NonCameraImageModel model = new NonCameraImageModel();     

              model.NotIntNo = notIntNo;       

              model.ImageUrls = GetNonCameraImage(notIntNo);

              return PartialView("NonCameraImagePartialView",model);       

      }

    *@

    @*UserListPartial.cshtml 视图*@

    @*@model int

    @model MvcApplication1.Models.UserDetail*@

    @model IEnumerable<MvcApplication1.Models.UserDetail>

    <h2>partialveiw</h2>

    @*<h2>@Model</h2>*@

    <table>  

       @foreach(var item in Model)  

       {                 <tr>            

                     <td>@item.UserID</td>            

                    <td>@item.UserName</td>       

                    </tr>    

          } </table>

  • 相关阅读:
    在ArcScene中为3D线设置纹理
    沿栅格单元边界生成块状等高线
    利用高程数据找出洼地和内部流域
    ArcMap 无法启动
    在分类渲染时,使用所有唯一值计算直方图
    ArcGIS三维分析扩展模块能否使用3ds max的模型
    如何创建带纹理的Multipatch
    云计算如“工业革命”般袭来 颠覆性改变需过安全关 狼人:
    金山毒霸2012正式公测 首次实现新病毒99秒查杀 狼人:
    瑞星:“云攻击”已成现实 狼人:
  • 原文地址:https://www.cnblogs.com/sxjljj/p/8537614.html
Copyright © 2011-2022 走看看