New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Server-side Programming Overview
You can configure the settings of RadBreadcrumb and create its items in the code-behind via the Server-Side API of the control.
RadBreadcrumb Public Properties and Methods
For a list with the server-side properties and methods of the control, see the Server-Side API of the RadBreadcrumb class. You can also find it in the IntelliSense in Visual Studio.
Create a RadBreadcrumb in the Code-behind:
ASP.NET
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
C#
protected void Page_Init(object sender, EventArgs e)
{
var breadcrumb = new RadBreadcrumb();
breadcrumb.ID = "RadBreadcrumb1";
breadcrumb.Skin = "Silk";
breadcrumb.RootIcon = "user";
breadcrumb.DelimiterIcon = "divide";
breadcrumb.DataBinding += new EventHandler(RadBreadcrumb1_DataBinding);
breadcrumb.Load += new EventHandler(RadBreadcrumb1_Load);
PlaceHolder1.Controls.Add(breadcrumb);
}
protected void RadBreadcrumb1_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
(sender as RadBreadcrumb).DataBind();
}
}
protected void RadBreadcrumb1_DataBinding(object sender, EventArgs e)
{
var breadcrumb = (sender as RadBreadcrumb);
breadcrumb.Items.AddRange(GetBreadcrumbItems(null));
}
private IEnumerable<BreadcrumbItem> GetBreadcrumbItems(object dataSource)
{
var result = new List<BreadcrumbItem>();
result.Add(new BreadcrumbItem() { Type = BreadcrumbItemType.RootItem });
result.Add(new BreadcrumbItem() { Text = "Item1", });
result.Add(new BreadcrumbItem() { Text = "Item2" });
result.Add(new BreadcrumbItem() { Text = "Item3" });
result.Add(new BreadcrumbItem() { Text = "Item4" });
return result;
}