Total Page Preview: 000000000731
What is page life cycle event in ASP.NET in English and Hindi
Page life cycle event in ASP.NET in English:
The page life cycle events in ASP.NET are a series of events that occur during the processing of a web page. These events help you control the page processing and provide opportunities to execute your custom code at different stages of the page life cycle. Here are the events that occur during the page life cycle in ASP.NET:
1-PreInit - This is the first event in the page life cycle, which is raised after the page's constructor is called but before any other events occur. This event is typically used to create or modify dynamic controls or to set the master page or theme for the page.
2-Init - This event is raised after all controls on the page are initialized and their state is restored. This event is typically used to initialize properties or controls that require a value to be set before they can be used.
3-InitComplete - This event allows tracking of view state.This event is raised after the Init event and before the Load event. This event is typically used to perform any additional initialization that cannot be done in the Init event.
4-LoadViewState - This event allows loading view state information into the controls.This event is raised after the page's view state has been restored. This event is typically used to read data from the view state that was saved during a previous request.
5-LoadPostData - This event is raised when the page is posted back to the server. This event is typically used to retrieve data from the form's controls.
6-Load - This event is raised when the page has been completely loaded into the server's memory. This event is typically used to load data from a database or perform any other processing that is required before the page can be displayed.
7-PreRender - This event is raised before the page is rendered to the browser. This event is typically used to modify the appearance of the page or to perform any final processing before the page is displayed.
8-SaveViewState - This event is raised after the PreRender event and is used to save the page's view state so that it can be restored during the next request.
9-Render - This event is used to render the HTML output for the page.
10-Unload - This event is raised after the page has been completely rendered and is about to be discarded. This event is typically used to perform any final cleanup or to release any resources that were used by the page.
Here is an example of using the Page_Load event to display a message in a Label control:
In this example, the Page_Load event is used to set the Text property of a Label control named Label1. When the page is loaded, the text "Welcome to the Page Life Cycle in ASP.NET" will be displayed in the label.
Page life cycle event in ASP.NET in Hindi:
ASP.NET mein page life cycle events wo events hai jo ek web page ke processing ke dauraan hotay hain. Ye events aapko page processing ko control karne mein madad karte hain aur aapko page life cycle ke alag alag stages mein apna custom code execute karne ke mouqa dete hain. Neechay ASP.NET mein page life cycle ke events diye gaye hain:
1-PreInit - Ye page life cycle ka pehla event hai jo page ke constructor ke baad raise hota hai lekin koi aur event abhi tak nahin hua hai. Ye event aam taur par dynamic controls ko create ya modify karne ke liye use kiya jata hai ya phir page ke liye master page ya theme set karne ke liye.
2-Init - Ye event page ke saare controls ko initialize karne ke baad raise hota hai aur inke state ko restore karne ke baad. Ye event aam taur par aise properties ya controls ko initialize karne ke liye use kiya jata hai jo pehle se hi koi value set hona zaruri hai.
3-InitComplete - Ye event Init event ke baad aur Load event se pehle raise hota hai. Ye event aam taur par Init event mein nahin kiye ja saktey koi additional initialization karne ke liye use kiya jata hai.
4-LoadViewState - Ye event page ke view state ko restore karne ke baad raise hota hai. Ye event aam taur par previous request mein save kiye gaye view state se data read karne ke liye use kiya jata hai.
5-LoadPostData - Ye event page ko server par post karne par raise hota hai. Ye event aam taur par form ke controls se data retrieve karne ke liye use kiya jata hai.
6-Load - Ye event page ko server ki memory mein completely load karne ke baad raise hota hai. Ye event aam taur par database se data load karne ya page ko display karne se pehle koi aur processing karne ke liye use kiya jata hai.
7-PreRender - Ye event page ko browser par render karne se pehle raise hota hai. Ye event aam taur par page ka appearance modify karne ya phir page ko display karne se pehle koi final processing karne ke liye use kiya jata hai.
8-SaveViewState - Ye event PreRender event ke baad raise hota hai aur page ke view state ko save karne ke liye use kiya jata hai taake wo next request mein restore kiya ja sake.
9-Render - Ye event page ke HTML output ko render karne ke liye use kiya jata hai.
10-Unload - Ye event page ko completely render karne ke baad raise hota hai aur wo discard hone ke baad use kiya jata hai. Ye event aam taur par final cleanup karne ya phir page mein use kiye gaye resources ko release karne ke liye use kiya jata hai.
Neechay ek example diya gaya hai jismein Page_Load event ka use Label control mein ek message display karne ke liye kiya gaya hai:
Is example mein Page_Load event ka use Label control ke Text property ko set karne ke liye kiya
Thank You
About Author
Brijesh Kumar
Database Developer
I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL
Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall
and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com