Which Page method will be called after all the controls Render methods have executed

Discussion in 'ASP .Net' started by Tomas, Feb 7, 2004.

  1. Tomas

    Tomas Guest

    Is there any sequence diagram on the web that clearly shows in which
    order all Page methods (load, render and so on) are being called
    compared to the order the page's contained control methods are being
    called by the asp.net enginge ???

    To be more specific, the thing I currently am most interested in
    understanding is from which method in the Page class you can know that
    that the Render method of all aggregated controls have been called so
    that you can use the result from the processing of those methods ???
    ( See code example below for an example of what I want to do, and the
    question is from which eventmethod in the aspx page (Page class) I
    know that the render method of the control has been executed )

    Or is it maybe not even possible ?
    Is maybe the Render method actually sending the html to the client as
    a datastream over the internet while the method is being executed ?
    As far as I have understood the asp.net, the render method in the
    child controls are just building up a XHTML DOM tree while executing
    it, and you can at some later stage even make the control's resulting
    html not be sent to the client by setting the Visible property for the
    control to false from the Page that aggregates the control.

    namespace MyDLL {
    public class MyControl : System.Web.UI.Control
    {
    private bool MyBool;
    protected override void Render(HtmlTextWriter output)
    {
    // some code ....
    if(something) {
    MyBool = true;
    }
    else {
    MyBool = false;
    }
    // some code ....
    }
    public bool isMyBoolTrue()
    {
    return MyBool;
    }
    }
    }

    The aspx-page using the control above:

    <%@ Register TagPrefix="MyDLL" Namespace="MyDLL" Assembly ="MyDLL"
    %>
    <html><body>

    <div runat="server" id="IDresult"></div>

    <MyDLL:MyControl runat="server"
    id="IDmyControl"></MyDLL:MyControl>

    </body></html>
    <script runat="server">
    public void WHAT_NAME_SHOULD_THIS_METHOD_HAVE() // Page_Load ,
    Page_Unload , "PostRender" ... ???
    {
    if(IDmyControl.isMyBoolTrue())
    {
    IDresult.innerText = "OK";
    }
    else
    {
    IDresult.innerText = "NOT OK";
    }
    }
    </script>
    Tomas, Feb 7, 2004
    #1
    1. Advertising

  2. Tomas

    Teemu Keiski Guest

    Hi,

    here are the phases explained.

    http://aspalliance.com/134

    If you want to know even more how to get to the Page and processing the
    request, check also these articles:
    http://msdn.microsoft.com/asp.net/d...-us/dnaspp/html/dngrftheaspnethttpruntime.asp
    http://msdn.microsoft.com/library/d.../en-us/dnaspp/html/aspnet-pageobjectmodel.asp

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist


    "Tomas" <> wrote in message
    news:...
    Is there any sequence diagram on the web that clearly shows in which
    order all Page methods (load, render and so on) are being called
    compared to the order the page's contained control methods are being
    called by the asp.net enginge ???

    To be more specific, the thing I currently am most interested in
    understanding is from which method in the Page class you can know that
    that the Render method of all aggregated controls have been called so
    that you can use the result from the processing of those methods ???
    ( See code example below for an example of what I want to do, and the
    question is from which eventmethod in the aspx page (Page class) I
    know that the render method of the control has been executed )

    Or is it maybe not even possible ?
    Is maybe the Render method actually sending the html to the client as
    a datastream over the internet while the method is being executed ?
    As far as I have understood the asp.net, the render method in the
    child controls are just building up a XHTML DOM tree while executing
    it, and you can at some later stage even make the control's resulting
    html not be sent to the client by setting the Visible property for the
    control to false from the Page that aggregates the control.

    namespace MyDLL {
    public class MyControl : System.Web.UI.Control
    {
    private bool MyBool;
    protected override void Render(HtmlTextWriter output)
    {
    // some code ....
    if(something) {
    MyBool = true;
    }
    else {
    MyBool = false;
    }
    // some code ....
    }
    public bool isMyBoolTrue()
    {
    return MyBool;
    }
    }
    }

    The aspx-page using the control above:

    &lt;%@ Register TagPrefix="MyDLL" Namespace="MyDLL" Assembly ="MyDLL"
    %&gt;
    &lt;html&gt;&lt;body&gt;

    &lt;div runat="server" id="IDresult"&gt;&lt;/div&gt;

    &lt;MyDLL:MyControl runat="server"
    id="IDmyControl"&gt;&lt;/MyDLL:MyControl&gt;

    &lt;/body&gt;&lt;/html&gt;
    &lt;script runat="server"&gt;
    public void WHAT_NAME_SHOULD_THIS_METHOD_HAVE() // Page_Load ,
    Page_Unload , "PostRender" ... ???
    {
    if(IDmyControl.isMyBoolTrue())
    {
    IDresult.innerText = "OK";
    }
    else
    {
    IDresult.innerText = "NOT OK";
    }
    }
    &lt;/script&gt;
    Teemu Keiski, Feb 8, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sally
    Replies:
    1
    Views:
    476
    bruce barker
    Apr 15, 2004
  2. Lau Lei Cheong

    Page.Render do not render complete page

    Lau Lei Cheong, May 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,065
    Lau Lei Cheong
    May 15, 2004
  3. Replies:
    0
    Views:
    686
  4. Luigi
    Replies:
    2
    Views:
    515
    Eliyahu Goldin
    May 22, 2006
  5. Glenn Gillen
    Replies:
    0
    Views:
    273
    Glenn Gillen
    Nov 17, 2006
Loading...

Share This Page