How to add a control to a masterpage contentplaceholderprogramattically

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DotNetNewbie

    How to add a control to a masterpage contentplaceholderprogramattically

    Hello,

    Say I want to override the current page's masterpage file, and I also
    want to programatically load a user control and inject the control in
    the master page's controlplacehol der.

    How would I do this?

    I am doing:

    protected override void OnPreInit(Event Args e)
    {
    base.OnPreInit( e);

    MasterPageFile = "~/Themes/Default/portal.Master";

    }


    Now how do I inject a user control in the MasterPageFile' s
    contentplacehol der with ID="content"?
Working...