zoukankan      html  css  js  c++  java
  • ASP.NET MVC2 in Action 读书笔记 [91] ChildAction

    1). ChildAction

    HomeController.cs:

    [HandleError]
        public class HomeController : Controller
        {
            public ActionResult Index()
            {
                ViewData["Message"] = "Welcome to ASP.NET MVC!";
     
                return View();
            }
     
            [ChildActionOnly]
            public ActionResult ChildAction()
            {
                return View();
            }
        }

    Index.aspx:

    <h2><%= Html.Encode(ViewData["Message"]) %></h2>
        <p>
            To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
        </p>
        <%Html.RenderAction("ChildAction"); %>

    ChildAction.aspx:

    <%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
     
    <h2>This view was rendered by calling RenderAction. This is a ChildAction</h2>
     
  • 相关阅读:
    php cookie名不能使用点号(句号)
    jquery:iframe里面的元素怎样触发父窗口元素的事件?
    __destruct与register_shutdown_function执行的先后顺序问题
    curl: (60) SSL certificate problem: unable to get local issuer certificate 错误
    js与as3交互的问题
    启动smaba后nginx 11 resource temporarily unavailable[转载]
    PHP错误: Exception thrown without a stack frame in Unknown on line 0[转载]
    Discuz x2.5的注册后返回第三方应用
    laravel-admin select关联
    laravel-admin 自动生成模块
  • 原文地址:https://www.cnblogs.com/RobotTech/p/2123800.html
Copyright © 2011-2022 走看看