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>

partialview 用法的更多相关文章

  1. ASP.NET MVC PartialView用法

    子页面AreaSelect.cshtml页面的Controller代码: public ActionResult AreaSelect() { return PartialView(); } 父页面前 ...

  2. EF5+MVC4系列(12) 在主视图中直接用RenderAction调用子Action,并返回视图(Return View)或者分部视图(Return PartialView); 从主Action传值到子Action使用TempData传值;TempData高级用法

    结论: ViewData 适用于 在一次请求中 传递数据  . 比如我们从 主Action 到 主视图, 然后在 主视图中  用 RenderAction 请求子Action的时候,就是算作 一次请求 ...

  3. ASP.NET MVC Ajax.ActionLink 简单用法

    ASP.NET MVC 项目中,如何使用类似于 iframe 的效果呢?或者说 Ajax 局部刷新,比如下面操作: 我们想要的效果是,点击 About 链接,页面不刷新(地址栏不变),然后下面的内容进 ...

  4. MVC5 + EF6 + Bootstrap3 (14) 分部视图PartialView

    Slark.NET-博客园 http://www.cnblogs.com/slark/p/mvc5-ef6-bs3-get-started-partialview.html 系列教程:MVC5 + E ...

  5. Partial RenderPartial Action RenderAction 区别和用法

    区别: 1.Partial 与 RenderPartial 两个方法性质基本一样,只是把一个静态用户控件给嵌入进来. 2.Partial 回传一堆html代码,直接写进到页面上@Html.Partia ...

  6. Asp.Net MVC3.0 Partial RenderPartial Action RenderAction 区别和用法

    本人写的博文不多,专业知识不强,以下纯属于个人笔记.如有不对,还请各路大拿,拍砖指导,谢谢! 区别: 1.Partial 与 RenderPartial 两个方法性质基本一样,只是把一个静态用户控件给 ...

  7. Html.Partial和Html. RenderPartial用法

    Html.Partial和Html. RenderPartial用法 Html.partial和RenderPartial的用法与区别Html.partial和RenderPartial都是输出htm ...

  8. asp.net mvc Html.BeginForm()及Html.Action用法

    Html.BeginForm    Add:操作方法的名称,Activities:控制器的名称,FormMethod.Post:定义from的method的值,,new { id = "fo ...

  9. MVC |分部视图 PartialView()

    介绍如何定义 其实它和普通视图没有多大区别,只是创建分部视图的时候视图里没有任何内容,你需要什么标签你自己加.第二就是分部视图不会执行_ViewStart.cshtml中的内容) 控制器 Partia ...

随机推荐

  1. 使用Dotfunsctor

    设置Disable Control Flow.Disable Renaming.Disable String Encryption 为no,no为开启该功能 设置加密后输出的路i经 选择需要加密的ex ...

  2. UCS内存问题排查

    UCS使用双列直插式内存模块(Dual In-line Memory Module (DIMM) )作为RAM模块. 根据文档介绍,主要有如下部分:1.Memory placement <内存放 ...

  3. 电脑读取U盘总提示格式化

    参考: https://zhidao.baidu.com/question/588981499.html 1.进入命令提示符界面:在此我们需要以管理员的身份进入命令提示符界面,可以通过右击桌面左下角的 ...

  4. 【PAT甲级】1060 Are They Equal (25 分)(需注意细节的模拟)

    题意: 输入一个正整数N(<=100),接着输入两个浮点数(可能包含前导零,对于PAT已经习惯以string输入了,这点未知),在保留N位有效数字的同时判断两个数是否相等,并以科学计数法输出. ...

  5. 【Android多线程】Thread和线程池

    https://www.bilibili.com/video/av65170691?p=3 (本文为此视频听课笔记) 一.为什么要使用多线程 二.Thread 2.1 通过继承Thread类 2.2 ...

  6. C++代码如何附加到C#写的主程序中?

    背景是这样:C#的exe程序,C#中调用C++的dll,也就是所谓的托管吧. C#的exe出了点问题,想在C++的dll的源码中调试,附加到进程时,加了断点,怎么也跟不进去.断点不变红啊,急死了. 最 ...

  7. FormsAuthentication.HashPasswordForStoringInConfigFile方法再.net core中的替代代码

    FormsAuthentication.HashPasswordForStoringInConfigFile()这个加密方法再.net core中不存在了,可以用下面的方式达到一样的加密效果 usin ...

  8. npm安装包时的几种模式

    本文原文地址:https://www.limitcode.com/detail/59a15b1a69e95702e0780249.html 回顾 npm install 命令 最近在写Node程序的时 ...

  9. 实用类-<装箱与拆箱>

    装箱:把基本数据类型装换为对应的对象类 作用:1.在需要使用对象类型的时候,装换成对应的对象类型(集合里面) 2.转换完成以后,拥有相应的属性和方法,方便咱们的数据操作 拆箱 Integer intO ...

  10. python学习 —— python3简单使用pymysql包操作数据库

    python3只支持pymysql(cpython >= 2.6 or >= 3.3,mysql >= 4.1),python2支持mysqldb. 两个例子: import pym ...