Thanks for your prompt reply.
Originally I made the breadcrumb as a user control and did what I needed to, including setting the ParentLevelsDisplayed property, in the code behind for that user control and it worked fine.
However, I had several controls that I had created like this and I decided that instead of having my users have to place several controls onto a template I would hard code the controls in the master page and create a single control that would manage aspects of all those controls.
So my setup is as follows:
On the master page:
And I have a user control (whose purpose is act as a single place to manage the controls on the master page) that
inherits from a class TemplateProperties in which I want to set properties of the breadcrumb:
TemplateProperties : System.Web.UI.UserControl
OnInit( EventArgs e )
( ((CmsPageBase)Page).PageMode==CmsPageMode.Live )
/// Find the home node
homeNodeFound = CmsAdmin.FindHomeNode(SiteMap.CurrentNode,
// Initialise the breadcrumb
// Initialise other controls ...
Breadcrumb _breadcrumb = (Breadcrumb)
_breadcrumb.ParentLevelsDisplayed = 1;
_breadcrumb.BackColor = System.Drawing.Color.Lime;
I have simplified the InitBreadcrumb method above for clarity, but my experience was that the back colour did get set but setting PerentLevelsDisplayed had no effect.
So I'm trying to set the breadcrumb properties OnInit, but I did also experiment and tried setting ParentLevelsDisplay both OnLoad and OnPreRender and still neither worked.
My current solution is:
Breadcrumb _breadcrumbPlaceholder = (Breadcrumb)
Control _breadcrumbContainer = _breadcrumbPlaceholder.Parent;
_breadcrumbIndex = _breadcrumbContainer.Controls.IndexOf(_breadcrumbPlaceholder);
// The telerik Breadcrumb control that will be inserted into the container
Breadcrumb _breadcrumb =
_breadcrumb.ID = controlId_;
_breadcrumb.ParentLevelsDisplayed = _levelsUp;
Thanks for your help.