Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Dynamically change MasterPage and ContentPlaceHolderID of asp content tag?
  2. private void Page_PreInit(object sender, EventArgs e)
  3.     {
  4.         if (Request.QueryString["Update"].ToString() == "New")
  5.         {
  6.             this.MasterPageFile = "MasterPage2.master";
  7.             Content con = new Content();
  8.             con = (Content)this.FindControl("Content1");
  9.             this.Content1.ContentPlaceHolderID = "ContentPlaceHolder2";
  10.         }
  11.     }
  12.        
  13. private void Page_PreInit(object sender, EventArgs e)
  14. {
  15.     if (Request.QueryString["Update"].ToString() == "New")
  16.     {
  17.         this.MasterPageFile = "MasterPage2.master";
  18.     }
  19. }