473,624 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnPreRender ??? What is ?

Hi, i'd like to know more abou this event, i tryed to found in MSDN but the
explanation is null for me...is there some explanation when and how should i
use it ?
Nov 19 '05 #1
4 2088
Pre-render isn't an event, it's a "stage" that a page instance goes through
Page_Init and Page_Load both occur during this stage.
"Daniel Groh" <ne*********@gm ail.com> wrote in message
news:OM******** ******@TK2MSFTN GP12.phx.gbl...
Hi, i'd like to know more abou this event, i tryed to found in MSDN but
the explanation is null for me...is there some explanation when and how
should i use it ?

Nov 19 '05 #2
OnPreRender is indeed an event raised as part of the page life-cycle. The
page's OnPreRender method may be overridden or a delegate may be used to
define an Event Handler in a manner similar to Page_Load and Page_Init.

[C#]
protected override void OnPreRender(Sys tem.EventArgs e)
{
// PreRender code
base.OnPreRende r();
}

or
this.PreRender += new System.EventHan dler(Page_PreRe nder);

OnPreRender is typically used for handling some last minute tasks such as
enabling or disabling controls or modifying other content after control
events have been handled but before the viewstate is saved and the HTML is
rendered [generated].

I'll refer you to
http://msdn.microsoft.com/library/de...bjectmodel.asp
for more information about the life cycle of an ASP.NET page.

HTH
----------------
Dave Fancher
http://www.davefancher.com

"Scott M." <No****@NoSpam. com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Pre-render isn't an event, it's a "stage" that a page instance goes
through Page_Init and Page_Load both occur during this stage.
"Daniel Groh" <ne*********@gm ail.com> wrote in message
news:OM******** ******@TK2MSFTN GP12.phx.gbl...
Hi, i'd like to know more abou this event, i tryed to found in MSDN but
the explanation is null for me...is there some explanation when and how
should i use it ?


Nov 19 '05 #3
just to say what Dave has said in another way (this from a ref book) "The
PreRender event is raised just before the page is about to render its
contents. This is the last chance to modify a page output before it is sent
to the browser".
"Daniel Groh" <ne*********@gm ail.com> wrote in message
news:OM******** ******@TK2MSFTN GP12.phx.gbl...
Hi, i'd like to know more abou this event, i tryed to found in MSDN but
the explanation is null for me...is there some explanation when and how
should i use it ?

Nov 19 '05 #4
OnPreRender is NOT the event, it's the method that raises the PreRender event.

and scott, Page_Load and Page_Init do NOT get called during the PreRender
phase. They are event handlers wired up to the Load and Init events
respectively.

PreRender is the last place you can change your control states before Render
is called recursively to generate the HTML output of a page. If you do a lot
of custom server controls, this is typically where you would register client
side javascripts among other things.

"Dave Fancher" wrote:
OnPreRender is indeed an event raised as part of the page life-cycle. The
page's OnPreRender method may be overridden or a delegate may be used to
define an Event Handler in a manner similar to Page_Load and Page_Init.

[C#]
protected override void OnPreRender(Sys tem.EventArgs e)
{
// PreRender code
base.OnPreRende r();
}

or
this.PreRender += new System.EventHan dler(Page_PreRe nder);

OnPreRender is typically used for handling some last minute tasks such as
enabling or disabling controls or modifying other content after control
events have been handled but before the viewstate is saved and the HTML is
rendered [generated].

I'll refer you to
http://msdn.microsoft.com/library/de...bjectmodel.asp
for more information about the life cycle of an ASP.NET page.

HTH
----------------
Dave Fancher
http://www.davefancher.com

"Scott M." <No****@NoSpam. com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Pre-render isn't an event, it's a "stage" that a page instance goes
through Page_Init and Page_Load both occur during this stage.
"Daniel Groh" <ne*********@gm ail.com> wrote in message
news:OM******** ******@TK2MSFTN GP12.phx.gbl...
Hi, i'd like to know more abou this event, i tryed to found in MSDN but
the explanation is null for me...is there some explanation when and how
should i use it ?



Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2946
by: Svein Erik Storkaas | last post by:
Hi, I have a page that has 1 textbox, 1 button and 1 label. It is a page where you have to write your email address, then you can click on the button to download a program. When the button is clicked it updates a downloadcounter I have made. All works fine except it wont update the textlabel that shows the current number of the counter. If I refresh the page, it updates. I know that i can use onPreRender in a way...but I am wondering if...
5
24576
by: Daniel Groh | last post by:
Hi, i'd like to know more abou this event, i tryed to found in MSDN but the explanation is null for me...is there some explanation when and how should i use it ?
3
2424
by: Kenton Smeltzer | last post by:
Hello All, I am having a problem with events and the addition of controls on a page I am developing. First let me tell you what I have tried and then maybe someone can see something I missed. First I tried adding the controls and the event handlers for my control in the Initialize Components method of my page in the hopes that it would fire the event before the
5
4159
by: Flare | last post by:
(ASP.NET 1.1) Hi I have a problem with my ViewStates in a userControl. The problem is that the ViewState is not "writte" og changed if you like after editing in my case a textbox. This is the code I use to add the User controll Control Component1 = null;
1
1585
by: Umut Tezduyar | last post by:
Because of the fact that, handling events method ( IPostBackEventHandler.RaisePorstBackEvent method) is prior to OnPreRender method, i cannot handle the events of the controls that i am adding on the OnPreRender method. Is there a way for that. Can i manually tell asp.net page to check again if there is control that is post backing to the server. ex: Load IPostBackEventHandler.RaisePostBackEvent ( in this phase parameter is
1
1661
by: Christophe Peillet | last post by:
I have a CompositeControl with two types of properties: 1.) Mapped Properties that map directly to a child control's properties (ex.: this.TextboxText = m_txt.Text). These properties are handled by their underlying classes (such as the TextBox control), and are not persisted by me. 2.) Unique Properties that don't map directly and are persisted in ViewState (ex.: this.LabelPosition, which specifies where on the form the label should be...
3
1566
by: Tarun Mistry | last post by:
Hi everyone. I have a usercontol that changes one of the ViewState variables, it does this when a button within it is pressed. I would like to alter the appearance of the page based on this view state variable, however i am told that the page has already been rendered at this point, what do i need todo to make my page "rerender" with the new viewstate information?
3
9664
by: John Scott | last post by:
Hey I've got an odd problem here. I have two user controls on a single page. Here is the flow of my page Page(OnLoad) UC1(OnPreRender) UC2(OnPreRender) Page(ButtonClick) UC1(OnPreRender) UC2....NOTHING
1
1583
by: 2310b | last post by:
I have a web form in which i use OnPreRender to load controls. it works fine BUT no matter what other events I call, the OnPreRender keeps executing. If I click on one of the buttons to fire off the OnClick event, the OnPreRender runs!!! I don't get it. I've never seen this behaviour before. Does anyone have any ideas??? here's part of the class... namespace mynamespace { /// <summary>
6
1781
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... Tried posting this on Build Controls but then saw that's a pretty slow group... Kind of a typical request from product management - they want to be able to swap in different 3rd party controls depending on their whim and the day. In this case, they want to support FreeTextBox and Cute Editor interchangably. I've been trying to put together a container control derived from
0
8168
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8672
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8614
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7153
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.