C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




PreRender Event


Posted Date: 16 Oct 2008      Total Responses: 3

Posted By: Cathrin       Member Level: Gold     Points: 1


Hi all ,

what does this line mean...
base.OnPreRender(e);
The coding is like this
what is the Purpose of OnPreRender?
It has the code for setting the visibility of button and filling the summary based on the previously filled details
protected override void OnPreRender(EventArgs e)
{
if (MultiView1.ActiveViewIndex == MultiView1.Views.Count - 1)
{
FillSummary();
}
btnBack.Visible = MultiView1.ActiveViewIndex > 0;
btnNext.Visible = MultiView1.ActiveViewIndex < MultiView1.Views.Count - 1;
btnSend.Visible = MultiView1.ActiveViewIndex == MultiView1.Views.Count - 1;
base.OnPreRender(e);
}




Responses

Author: Meetu Choudhary    16 Oct 2008Member Level: GoldRating:     Points: 2
the prerender event is executed before the rendering of the particular object so if you want to set the details before the object is displayed or rendered to the user we use this event

hope it is clear to you now.

==
Thanks and regards
Meetu Choudhary


Author: gomathinayagam    16 Oct 2008Member Level: GoldRating:     Points: 2
After PostBack event, page prepares for rendering. PreRender event is called. This is the place where user can do the update operations before the viewstate is stored and output is rendered. Next stage is saving view state, all the values of the controls will be saved to their own viewstate collection. The resultant viewstate is serialized, hashed, base24 encoded and associated with the _viewstate hidden field.



Author: Nagarajan    16 Oct 2008Member Level: GoldRating:     Points: -20
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.

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].

In another way "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".

Hope this helps
Happy Coder.


Post Reply
You must Sign In to post a response.
Next : need per day visitors count
Previous : To saisrikanthreddy
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

conference calls

Contact Us    Privacy Policy    Terms Of Use