I am working in asp.net 3.5/4.0. can i know about how can we add master page in runtime?
Master Page
Hello Sir..
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sunny SharmaRank #223 · 11.1K reputationPosted Aug 13, 2013, 11:02 PM EDT
To add a master at runtime, you need to specify the desired master page before the page is initialized. Add this code block inside your page' code behind file:
------------------------------------------------------ protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); this.MasterPageFile = "~/newMaster.master"; // Here Goes your master file } ------------------------------------------------------- Happy coding :)Iftikar HussainRank #423 · 5.9K reputationPosted Aug 13, 2013, 11:03 PM EDT
Please let me know the requirement for adding the master page at runtime. So that I can provide you correct solution.
Regards,
Iftikar
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 13, 2013, 11:03 PM EDT
refer to this link it may help you
http://forums.asp.net/post/2508056.aspx