{"id":853,"date":"2010-08-15T06:03:00","date_gmt":"2010-08-15T05:03:00","guid":{"rendered":"http:\/\/it4bus.vn\/itersdesktop\/2010\/08\/15\/stuffs-during-building-ephy10\/"},"modified":"2013-12-01T01:24:52","modified_gmt":"2013-12-01T00:24:52","slug":"stuffs-during-building-ephy10","status":"publish","type":"post","link":"https:\/\/www.itersdesktop.com\/vi\/2010\/08\/15\/stuffs-during-building-ephy10\/","title":{"rendered":"Stuffs during building EPHY10"},"content":{"rendered":"<ul>\n<li>Each page in ASP.NET 2.0 or upper has the <b>AutoEventWireup<\/b> tag set to true, which means that all this page initialization events are type by yourself.<\/li>\n<\/ul>\n<p>use this code directly<br \/>\n<span><span>protected<\/span><\/span><span><span>void<\/span><\/span><span> Page_PreRender(<\/span><span><span>object<\/span><\/span><span> sender, <\/span><span><span>EventArgs<\/span><\/span><span> e)<\/span><span>{<\/span><br \/>\n<span><span>\/\/ your code goes here<\/span><\/span><br \/>\n<span> }<\/span><\/p>\n<p><span><b>ASP.NET 2.0 Page Event Life Cycle<\/b>\u00a0<\/span><br \/>\n<span>This content is copied from [1]. Many thanks to the author of the article.<\/span><br \/>\n<span><br \/>\n<\/span><\/p>\n<div align=\"justify\"><span>In this article, we will explore the various events that occur when an asp.net 2.0 page is requested from the server. Before exploring that, let us briefly take a look at the various components that participate in the request and response model for asp.net pages.<\/span><\/div>\n<div align=\"justify\"><span>When a request is made to the server using HTTP (GET), IIS receives the request and passes it to the asp.net engine(dll) that compiles the page that is\u00a0requested. The request passes through two sections :<\/span><\/div>\n<div align=\"justify\"><span>\u00a0Http Module \u2013 Monitors the request and takes action. Authentication and Authorization take place over here.<\/span><\/div>\n<div align=\"justify\"><span>Http Handler \u2013 Responsible for compiling the page and generating output using System.Web.UI.PageHandlerFactory (we are considering .aspx page for this article).<\/span><\/div>\n<div align=\"justify\"><span>Once compilation is done, the page is sent back to the Http module which then sends it to the IIS and back to the browser.<\/span><\/div>\n<div align=\"justify\"><span>The events occur in the following sequence. Its best to turn on tracing(&lt; % @Page Trace=\u201dtrue\u201d%&gt;) and track the flow of events :<\/span><\/div>\n<div align=\"justify\"><b><span>PreInit <\/span><\/b><span>\u2013 This event represents the entry point of the page life cycle. If you need to change the Master page or theme programmatically, then this would be the event to do so. Dynamic controls are created in this event.<\/span><\/div>\n<div align=\"justify\"><b><span>Init<\/span><\/b><span> \u2013 Each control in the control collection is initialized. <\/span><\/div>\n<div align=\"justify\"><b><span>Init Complete<\/span><\/b><span>* &#8211; Page is initialized and the process is completed.<\/span><\/div>\n<div align=\"justify\"><b><span>PreLoad<\/span><\/b><span>* &#8211; This event is called before the loading of the page is completed. <\/span><\/div>\n<div align=\"justify\"><b><span>Load<\/span><\/b><span> \u2013 This event is raised for the Page and then all child controls. The controls properties and view state can be accessed at this stage. This event indicates that the controls have been fully loaded.<\/span><\/div>\n<div align=\"justify\"><b><span>LoadComplete<\/span><\/b><span>* &#8211; This event signals indicates that the page has been loaded in the memory. It also marks the beginning of the rendering stage.<\/span><\/div>\n<div align=\"justify\"><b><span>PreRender<\/span><\/b><span> \u2013 If you need to make any final updates to the contents of the controls or the page, then use this event.\u00a0It first fires for the page and then for all the controls.<\/span><\/div>\n<div align=\"justify\"><b><span>PreRenderComplete<\/span><\/b><span>* &#8211; Is called to explicitly state that the PreRender phase is completed. <\/span><\/div>\n<div align=\"justify\"><b><span>SaveStateComplete<\/span><\/b><span>* &#8211; In this event, the current state of the control is completely saved to the ViewState.<\/span><\/div>\n<div align=\"justify\"><b><span>Unload <\/span><\/b><span>\u2013 This event is typically used for closing files and database connections. At times, it is also used for logging some wrap-up tasks.<\/span><\/div>\n<p><b><span>FreeTextBox<\/span><\/b><br \/>\n<b>Providing a Richer Means for Entering Text Data<\/b><\/p>\n<p>The issue is represented in the useful article [2]. We want to have Browse&#8230; button to select an image for inserting in a document.<\/p>\n<p>FreeTextBox: http:\/\/forums.aspfree.com\/net-development-11\/freetextbox-imagegallery-213698.html<br \/>\nhttp:\/\/www.websitebabble.com\/web-design-development-software-including-cms\/3848-asp-net-freetextbox.html<\/p>\n<p>References:<br \/>\n<span>[1] ASP.NET 2.0 Page Event Life Cycle, http:\/\/www.dotnetcurry.com\/ShowArticle.aspx?ID=83&amp;AspxAutoDetectCookieSupport=1, retrieved 14\/08\/2010<\/span><br \/>\n[2] <span>Providing a Richer Means for Entering Text Data, <\/span>http:\/\/www.4guysfromrolla.com\/articles\/102004-1.aspx, retrieved 15\/08\/2010<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Each page in ASP.NET 2.0 or upper has the AutoEventWireup tag set to true, which means that all this page initialization events are type by yourself. use this code directly&hellip; <\/p>\n","protected":false},"author":2,"featured_media":981,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[243,225,4,222],"tags":[318,319,317],"class_list":["post-853","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ephy10","category-web-design","category-web-engineering","category-web-programming","tag-asp-net-2","tag-lectures","tag-linq"],"_links":{"self":[{"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/posts\/853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/comments?post=853"}],"version-history":[{"count":2,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/posts\/853\/revisions"}],"predecessor-version":[{"id":983,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/posts\/853\/revisions\/983"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/media\/981"}],"wp:attachment":[{"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/media?parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/categories?post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/tags?post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}