Control

[ChildActionOnly]      //只能用于Child Action
public ActionResult Time() {
return PartialView(DateTime.Now);
}

 

View

@model DateTime
<p>The time is: @Model.ToShortTimeString()</p>

 

 

@Html.Action("Time")

 

与分布视图不同的是,Child Action可以在Control中提供需要的数据。

Child Action的更多相关文章

  1. [ASP.NET MVC 小牛之路]12 - Section、Partial View 和 Child Action

    概括的讲,View中的内容可以分为静态和动态两部分.静态内容一般是html元素,而动态内容指的是在应用程序运行的时候动态创建的内容.给View添加动态内容的方式可归纳为下面几种: Inline cod ...

  2. [转][ASP.NET MVC 小牛之路]12 - Section、Partial View 和 Child Action

    本文转自:http://www.cnblogs.com/willick/p/3410855.html 概括的讲,View中的内容可以分为静态和动态两部分.静态内容一般是html元素,而动态内容指的是在 ...

  3. 【ASP.NET MVC 学习笔记】- 13 Child Action

    本文参考:http://www.cnblogs.com/willick/p/3410855.html 1.Child action 和 Patial view 类似,也是在应用程序的不同地方可以重复利 ...

  4. ASP.NET MVC中Section、Partial View 和 Child Action(转载)

    概括的讲,View中的内容可以分为静态和动态两部分.静态内容一般是html元素,而动态内容指的是在应用程序运行的时候动态创建的内容.给View添加动态内容的方式可归纳为下面几种: Inline cod ...

  5. Html.BeginForm 与Section、Partial View 和 Child Action

    该方法用于构建一个From表单的开始,他的构造方法为: Html.BeginForm("ActionName","ControllerName",FormMet ...

  6. mvc razor中renderPartial,RenderAction,Partial,Action的使用选择

    RenderPartial: 通常被用来显示一个功能相对独立的“块”,比如说显示菜单或者导航条. RenderPartial输出的结果被作为调用的View的一部分显示. 这个方法会直接将结果写入到当前 ...

  7. [ASP.NET MVC] Child actions are not allowed to perform redirect

    我在Umbraco平台下,用MVC(SurfaceController)开发时,遇到这个问题 MemberEdit是一个partial View [HttpGet] [ActionName(" ...

  8. RenderPartial RenderAction Partial Action

    MVC Razor中有不同的展现partial view的方法,许多开发人员子在选择使用 RenderPartial or RenderAction or Partial or Action help ...

  9. 乡下人重拾MVC——@RenderBody @RenderSection @Html.Partial @Html.Action @Html.RenderPartial @Html.RenderAction

    1.   @RenderBody()  代表:是一个占位符,是留给子页面的位置,子页面使用这个模版,子页面中的内容会被放到@RenderBody的位置.合并后当作一个整体加载 2.   @Render ...

随机推荐

  1. 获取 exception 对象的字符串形式(接口服务返回给调用者)

    工具类: package com.taotao.common.utils; import java.io.PrintWriter; import java.io.StringWriter; publi ...

  2. Efficient Deblurring for Shaken and Partially Saturated Images

    Try the online demo: http://willow-fd.rocq.inria.fr/unshake/ Overview One common feature of “shaken” ...

  3. Codeforces Round #396 (Div. 2) A B C D 水 trick dp 并查集

    A. Mahmoud and Longest Uncommon Subsequence time limit per test 2 seconds memory limit per test 256 ...

  4. [samba]samba设置指定用户权限

    步骤: 1.在系统中添加用户 批量添加用户和密码的方法(因为samba用户要求必须在系统中存在): for name in a b c d;do useradd $name ; echo " ...

  5. opencv学习---打开摄像头检测个人头像

    opencv中具有检测人体各部分的级联分类器,在opencv文件夹里面的sources/data/haarcascades里面. 这里要选择的是能够检测人体头像的还有检测眼睛的级联分类器的文件. 它们 ...

  6. linux下输出查看进程及杀进程

    1.查找有关tomcat的进程 ps -ef | grep tomcat 2.查看某端口占用情况 netstat -tulpn | grep 9009 3.杀进程 普通:kill 进程id 强制:ki ...

  7. [Luogu 3973] TJOI2015 线性代数

    [Luogu 3973] TJOI2015 线性代数 这竟然是一道最小割模型. 据说是最大权闭合子图. 先把矩阵式子推出来. 然后,套路建模就好. #include <algorithm> ...

  8. 图书馆排序(Library Sort)

    思路简介,大概意思是说,排列图书时,如果在每本书之间留一定的空隙,那么在进行插入时就有可能会少移动一些书,说白了就是在插入排序的基础上,给书与书之间留一定的空隙,这个空隙越大,需要移动的书就越少,这是 ...

  9. linux 执行shell脚本的4种方法总结

    bash shell 脚本的方法有多种,假设我们编写好的shell脚本的文件名为hello.sh,文件位置在/data/shell目录中并已有执行权限. 方法一:切换到shell脚本所在的目录(此时, ...

  10. iOS tag的使用

    一.添加标记 (标记不能为0) UIButton *backBtn = [[UIButton alloc] initWithFrame:CGRectMake(,,,)]; backBtn.backgr ...