How to Change MasterPage in Runtime

Posted by Prabhakar under ASP.NET on 1/24/2011 | Points: 10 | Views : 10220 | Status : [Member] [MVP] | Replies : 5
i want to code how to change masterpage in runtime

Advance thanks
Prabhakar

Best Regard's
Prabhakar



Responses

Posted by: SheoNarayan on: 1/24/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Write the following code in Page_PreInit event

this.Page.MasterPageFile = "~/yourMasterpage.master";


Thanks


Regards,
Sheo Narayan
http://www.dotnetfunda.com

Prabhakar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/24/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

Check this article

http://www.codeproject.com/KB/aspnet/Changing_Master_Page.aspx

Thanks
Karthik
www.f5Debug.net

Prabhakar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/24/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
If you want to dynamically load the master page at runtime based on some condition then check this below link

http://ryanfarley.com/blog/archive/2004/06/16/788.aspx

Thanks
Karthik
www.f5Debug.net

Prabhakar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyam1512 on: 1/24/2011 [Member] Starter | Points: 25

Up
0
Down
If you want to add master page dynamically on web.config file, Please check this link..

http://mr-ponna.com/Question/413/Can-we-set-Master-page-dynamically-at-runtime-/

Prabhakar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 1/25/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi thanks fo r all of u ..

i ma resolved my problem with ur suggestion ...

Thanks & Regard's
Prabhakar

Best Regard's
Prabhakar

Prabhakar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response