Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Which Page method will be called after all the controls Render methods have executed

Reply
Thread Tools

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

 
 
Tomas
Guest
Posts: n/a
 
      02-07-2004
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>


 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      02-08-2004
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/de...ttpruntime.asp
http://msdn.microsoft.com/library/de...bjectmodel.asp

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


"Tomas" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
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;



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The Update method can only be called on UpdatePanel with ID 'UpdatePanel1' before Render.| Jeff ASP .Net 0 03-08-2008 01:13 PM
Accessing rails render method outside of view / Decorating render Glenn Gillen Ruby 0 11-17-2006 02:30 PM
Master page code executed after child page code Luigi ASP .Net 2 05-22-2006 09:53 AM
Page.Render do not render complete page Lau Lei Cheong ASP .Net 1 05-15-2004 04:10 AM
When Page.OnInit is done and exited, can I be sure that ALL child controls have called OnInit as well? Sally ASP .Net 1 04-15-2004 01:15 AM



Advertisments