SiteMap  | About    

How to Set Master Page dynamically?

Yes. You can assign a master page dynamically during the PreInit stage. Because the master page and content page are merged during the initialization stage of page processing, a master page must be assigned before then.

PreInit event enables you to check conditions of the page request, such as whether the page is being loaded in response to a postback. You can also check the values of profile properties. Attempting to set the MasterPageFile property after the PreInit event will throw an InvalidOperationException exception. If the MasterPageFile property is not valid, an exception of type HttpException is thrown later in the page life cycle, but no exception is thrown when the property is set in the PreInit event. (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.