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. programmatically how to select MasterPage

programmatically how to select MasterPage

Scheduled Pinned Locked Moved ASP.NET
tutorialhelp
2 Posts 2 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.
  • K Offline
    K Offline
    kvsreedhar
    wrote on last edited by
    #1

    I have a content page and two Master pages . Based on some condition I want to call one Master to the content page . For example C1 is a content page , M1 and M2 are two master pages based on some condition in C1(atloading of C1) page I want M1 or M2 to be called in C1 programmatically. anyone please Help me out :rose: Thanks in Advance :rose:

    Kovuru Sreedhar

    B 1 Reply Last reply
    0
    • K kvsreedhar

      I have a content page and two Master pages . Based on some condition I want to call one Master to the content page . For example C1 is a content page , M1 and M2 are two master pages based on some condition in C1(atloading of C1) page I want M1 or M2 to be called in C1 programmatically. anyone please Help me out :rose: Thanks in Advance :rose:

      Kovuru Sreedhar

      B Offline
      B Offline
      Brij
      wrote on last edited by
      #2

      You can set the masterpage of any page at runtime in pre_init event like protected void Page_PreInit(object sender, EventArgs e) { if (Request.Params[A1] != null) { this.MasterPageFile = "~/MasterPages/A1.master"; } else if (Request.Params[A2] != null) { this.MasterPageFile = "~/MasterPages/A2.master"; } else if (Request.Params[A#] != null) { this.MasterPageFile = "~/MasterPages/A3.master"; } }

      Cheers!! Brij

      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