actually i have created three master pages and now i want to implement them all into single page one by one by selecting a master page from drop down list at run time so ill you guide me how to achieve it.
how to change master page at run time
Collapse
X
-
Tags: None
-
Well the page has a MasterPageFile property.
You can set this declaratively in your ASP code or you could do this in your sever side C# or VB.NET code.
Since you want to be able to change the MasterPageFile property depending on what the user has selected I recommend you do this in your server side code.
For example (vb.net):
(c#)Code:Me.MasterPageFile = "..."
-FrinnyCode:this.MasterPageFile = "...."
-
where i have to write this code and will it work for all pages.means after selecting a masterpage will it be loaded in all pages ?Well the page has a MasterPageFile property.
You can set this declaratively in your ASP code or you could do this in your sever side C# or VB.NET code.
Since you want to be able to change the MasterPageFile property depending on what the user has selected I recommend you do this in your server side code.
For example (vb.net):
(c#)Code:Me.MasterPageFile = "..."
-FrinnyCode:this.MasterPageFile = "...."
Comment
-
I would imagine you would place this code where you need it: when the user selects the master page to use
I don't know if it will work for future page requests...it may...it may not...
Actually.... if you place this code that in the PreRender event for the page then you could set it every time based on the user's selection...see ms simple enough.
If you don't want to do that, then you just have to remember the master page currently being used by storing it somewhere (ViewState, Session, a HiddenField, a cookie...)Comment
Comment