Author: Thommy | Posted on: 10/29/2010 3:49:49 AM | Views : 275

Hello!


I've got a number of MasterPages with ContentPlaceHolders. I do not know how much Placeholders are on the MasterPage. Now i want to load Content to the PlaceHolder, id the ContentPlaceHolder exists.


When i use the this.Master.FindControl the MasterPage renders and the added Content would not be rendered.
See: http://stackoverflow.com/questions/246707/dynamically-adding-content-blocks-to-masterpage-fails-after-master-findcontrol


Soo I tried two posibilities  of adding the content:


protected void Page_PreInit(Object sender, EventArgs e) { const int PlaceHolderToFill = 2; if(Page.Session["master"] != null) { this.MasterPageFile = Page.Session["master"] + ".master"; } for (int i = 1; i <= PlaceHolderToFill; i++) { Control PlaceHold ...

Go to the complete details ...