Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Master page is to changed

Master page is to changed

Scheduled Pinned Locked Moved ASP.NET
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BalasubramanianK
    wrote on last edited by
    #1

    Is possible to change the master page at runtime. tnx in adv.

    Balasubramanian K.

    H A 2 Replies Last reply
    0
    • B BalasubramanianK

      Is possible to change the master page at runtime. tnx in adv.

      Balasubramanian K.

      H Offline
      H Offline
      hemant kaushal
      wrote on last edited by
      #2

      yes u can Page.MasterPageFile = "name of master page"

      A 1 Reply Last reply
      0
      • B BalasubramanianK

        Is possible to change the master page at runtime. tnx in adv.

        Balasubramanian K.

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        yes. You can change it on Page_PreInit() Event
        protected void Page_PreInit(object sender, EventArgs e) { if (Request.Params["PageName1"] != null) { this.MasterPageFile = "~/MasterPages/PageName1.master"; } else if (Request.Params["PageName2"] != null) { this.MasterPageFile = "~/MasterPages/PageName2.master"; } else { this.MasterPageFile = "~/MasterPages/Default.master"; }} ;)

        cheers, Abhijit Read My Latest Article : IIS 7.0 and Deploying Asp.Net WebSites on IIS 7.0

        B 1 Reply Last reply
        0
        • H hemant kaushal

          yes u can Page.MasterPageFile = "name of master page"

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          yes and This should be write in Page_PreInit() Event .

          cheers, Abhijit Read My Latest Article : IIS 7.0 and Deploying Asp.Net WebSites on IIS 7.0

          1 Reply Last reply
          0
          • A Abhijit Jana

            yes. You can change it on Page_PreInit() Event
            protected void Page_PreInit(object sender, EventArgs e) { if (Request.Params["PageName1"] != null) { this.MasterPageFile = "~/MasterPages/PageName1.master"; } else if (Request.Params["PageName2"] != null) { this.MasterPageFile = "~/MasterPages/PageName2.master"; } else { this.MasterPageFile = "~/MasterPages/Default.master"; }} ;)

            cheers, Abhijit Read My Latest Article : IIS 7.0 and Deploying Asp.Net WebSites on IIS 7.0

            B Offline
            B Offline
            BalasubramanianK
            wrote on last edited by
            #5

            Yah.. thank you

            Balasubramanian K.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups