PagePreInit is used to write the user-selected theme - ASP.NET Introduction

Q.  You need to allow users to choose their own themes. In which page event will you write the user-selected theme?
- Published on 24 Jul 15

a. Page_Load
b. Page_Render
c. Page_PreInit
d. Page_PreRender

ANSWER: Page_PreInit
 

    Discussion

  • Raj Singh   -Posted on 13 Sep 15
    To apply a theme programmatically, you can use to set the page’s Theme property in the Page_PreInit method. Page_PreInit is the proper method in which you can specify the theme.
    Other properties of Page_PreInit event are as follows.
    • You can check conditions of the page request, such as whether the page is being loaded in response to a postback.
    • Set the values of profile properties.
    • You can dynamically set a master page.
    • Create dynamic controls

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)