I have to find the IDs of all the contentPlaceHolders in a MasterPage.
A:
Iterate through all Controls and recursively through their subcontrols and check the type and if they are contentplaceholders you have the ID.
Gambrinus
2009-02-05 09:49:05
An example would be gr8..As I am using a nested Master Page . I have written a function which takes MasterPage as Parameter and loops throus all the controls. but for some unknown reason its not able to find the ContentPlaceHolder
2009-02-05 09:54:50
Perhaps you should edit your question to include the code you have already written.
Cerebrus
2009-02-05 10:41:47
+1
A:
Just query the ContentPlaceHolders
property which returns an IList containing all the CPH names in the given Master page.
VB code: (Sorry!)
'In the Master Page.
For Each cphID As String In Me.ContentPlaceHolders
Debug.WriteLine(cphID)
Next
Cerebrus
2009-02-05 10:13:09
+1
A:
try:
for (string cphID in ((MasterPageType)this.MasterPage).ContentPlaceHolders)
{
Debug.WriteLine(cphID);
}
In the code behind of your page, and replace MasterPageType with the type of your master page
Adam Naylor
2009-02-05 10:53:24