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

T

Tomas

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>
 
T

Teemu Keiski

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


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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top