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. 关于浮动&关于BFC规范&whyoverflow清除浮动

    https://www.cnblogs.com/smivico/p/7656270.html 浮动 https://www.jianshu.com/p/4b93eecb090e BFC https:/ ...

  2. Tensorflow机器学习入门——AttributeError: module 'scipy.misc' has no attribute 'toimage'

    这个bug的解决办法: import cv2 # scipy.misc.toimage(image_array).save('cifar10_data/raw/%d.jpg' % i) cv2.imw ...

  3. UIScrollView的API

    @property(nonatomic, weak) id<UIScrollViewDelegate> delegate; 滚动视图对象的委托. @property(nonatomic) ...

  4. 简单优化MySQL(后续在补充)

    如何优化: ---从设计表结构的角度出发: 用多个小表代替一个大表,注意不要过度设计 批量插入代替循环插入 合理控制缓存空间大小,一般来说其大小设置为几十兆比较合适 可以通过 SQL_CACHE 和 ...

  5. day2-2循环语句

    ECMAScript不存在块级作用域,在循环内部定义的变量也可以在外部访问到 局部变量与全局变量: 1) 使用var操作符定义的变量将成为定义该变量的作用域中的局部变量. 2) 如果在函数中定义变量没 ...

  6. Eclipse上将maven项目部署到tomcat,本地tomcat下,webapps下,web-inf下lib下没有jar包决绝方案

    右键项目选择properties  ,选择Deployment Assembly  , 右边点击Add 然后选择  Java Build Path Entries ,,,next  ,  选择Mave ...

  7. git 从创建到推送到远程,到拉取,实操

    https://www.liaoxuefeng.com/wiki/896043488029600/900003767775424 初始化 git init 添加所有文件到暂存区 git add . c ...

  8. ALSA 有关文档

    Alsa项目的官方网址:http://www.alsa-project.org/ Alsa LIB API Reference:http://www.alsa-project.org/alsa-doc ...

  9. tensorflow简介、目录

    目前工作为nlp相关的分类及数据治理,之前也使用tensorflow写过一些简单分类的代码,感受到深度学习确实用处较大,想更加系统和全面的学习下tensorflow的相关知识,于是我默默的打开了b站: ...

  10. android 简单列表对话框(AlertDialog.Builder().setItems())

    ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 ...