zoukankan      html  css  js  c++  java
  • page life cycle of master page with content page

    Generally one question is faced by very developer what is asp.net page life cycle every body know very well like sequence of asp.net page event like

    1. page_init
    2. Page_load
    3. Page_render
    4. Page_unload

    it is fine for standalone pages but if a page have master page then what the page life cycle? confuse!!!

    Below is the sequence of event of page events which contain master page  with chronological order.

    1. Master page (Page_Init) event
    2. Content page (Page_Init) event
    3. Content page (Page_Load) event
    4. Master page (Page_Load) event
    5. Content page (Page_Prerender) event
    6. Master page (Page_Prerender) event
    7. Content page (Page_Prerendercomplete) event
    8. Master page (Page_Prerendercomplete) event

    Remember one thing  page life cycle of page contain master page all event fire like first master page event then content page event but in case of page load event first content page load event fire then master page event fire. so that’s all from my side

    I think It may help you, Happy coding, stay turned for more…

    Thank You

    Accessing Members on the Master Page

    To provide access to members of the master page, the Page class exposes a Master property. To access members of a specific master page from a content page, you can create a strongly typed reference to the master page by creating a @ MasterType directive. The directive allows you to point to a specific master page. When the page creates its Master property, the property is typed to the referenced master page.

    For example, you might have a master page named MasterPage.master that is the class name MasterPage_master. You might create @ Page and @ MasterType directives that look like the following:

    <%@ Page  masterPageFile="~/MasterPage.master"%>

    <%@ MasterType  virtualPath="~/MasterPage.master"%>

    When you use a @ MasterType directive, such as the one in the example, you can reference members on the master page as in the following example:

    CompanyName.Text = Master.CompanyName;


    From:http://msdn.microsoft.com/en-us/library/c8y19k6h%28v=vs.80%29.aspx#Y0

  • 相关阅读:
    滤波和减采样的互换
    LwIP情景示例
    [redis] redis 对string类型数据操作
    [ExtJs] ExtJs4.2 数据模型Ext.data.Model学习
    [生活] 90年前后出生的人现状如何?
    【java】java内存模型(2)--volatile内存语义详解
    【java】java内存模型 (1)--基础
    [extjs] ExtJS 4.2 开发环境搭建
    强烈推荐:240多个jQuery插件
    使用CXF为webservice添加拦截器
  • 原文地址:https://www.cnblogs.com/cw_volcano/p/2553890.html
Copyright © 2011-2022 走看看