|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
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 ? 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. Show quoteHide quote "Daniel Groh" <newsgrou***@gmail.com> wrote in message news:OM1REZVbFHA.3204@TK2MSFTNGP12.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 ? > 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(System.EventArgs e) { // PreRender code base.OnPreRender(); } or this.PreRender += new System.EventHandler(Page_PreRender); 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/default.asp?url=/library/en-us/dnaspp/html/aspnet-pageobjectmodel.asp for more information about the life cycle of an ASP.NET page. HTH ---------------- Dave Fancher http://www.davefancher.com Show quoteHide quote "Scott M." <NoSpam@NoSpam.com> wrote in message news:%23t1WegWbFHA.228@TK2MSFTNGP12.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" <newsgrou***@gmail.com> wrote in message > news:OM1REZVbFHA.3204@TK2MSFTNGP12.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 ? >> > > 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. Show quoteHide quote "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(System.EventArgs e) > { > // PreRender code > base.OnPreRender(); > } > > or > this.PreRender += new System.EventHandler(Page_PreRender); > > 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/default.asp?url=/library/en-us/dnaspp/html/aspnet-pageobjectmodel.asp > for more information about the life cycle of an ASP.NET page. > > HTH > ---------------- > Dave Fancher > http://www.davefancher.com > > "Scott M." <NoSpam@NoSpam.com> wrote in message > news:%23t1WegWbFHA.228@TK2MSFTNGP12.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" <newsgrou***@gmail.com> wrote in message > > news:OM1REZVbFHA.3204@TK2MSFTNGP12.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 ? > >> > > > > > > > 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". Show quoteHide quote "Daniel Groh" <newsgrou***@gmail.com> wrote in message news:OM1REZVbFHA.3204@TK2MSFTNGP12.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 ? >
Other interesting topics
Session State stateserver or Sql Server
Did I do this correctly? - Display resized image from DB. Asynchronous Call <Head>Tag PostBack problem Render and get html from usercontrol 2.0 App-Code Folder Support for 'Code-Behind' HttpWebRequest.GetResponse on POST returns 405 method not allowed LDAP Query Help Difference between Page_Load and OnLoad |
|||||||||||||||||||||||