New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Databinding with Custom Attributes

Updated on Aug 24, 2026

When binding the Telerik RadMenu to data, custom attributes can be set in the ItemDataBound event.

Here is an example:

ASP.NET
<telerik:RadMenu RenderMode="Lightweight" ID="RadMenu1" runat="server" OnItemDataBound="RadMenu1_ItemDataBound">
</telerik:RadMenu>
C#
protected void Page_Load(object sender, EventArgs e){    
    //dynamically crate a table to populate the menu    
    DataTable table1 = new DataTable();

    table1.Columns.Add("ID");    
    table1.Columns.Add("ParentID");    
    table1.Columns.Add("Roles"); 
    // the column for the custom attributes    
    table1.Columns.Add("Text");
    table1.Rows.Add(new string[] { "1", null, "1", "Politics" });    
    table1.Rows.Add(new string[] { "2", null, "1", "Sports" });    
    table1.Rows.Add(new string[] { "3", null, "3", "Events" });    
    table1.Rows.Add(new string[] { "4", "1", "4", "CNN" });    
    table1.Rows.Add(new string[] { "5", "1", "5", "NBC" });    
    table1.Rows.Add(new string[] { "6", "1", "6", "ABC" });    
    table1.Rows.Add(new string[] { "7", "2", "7", "US Sports" });    
    table1.Rows.Add(new string[] { "8", "2", "2", "European Sports" });    
    table1.Rows.Add(new string[] { "9", "7", "4", "Baseball" });    
    table1.Rows.Add(new string[] { "10", "7", "3", "Football" });    
    table1.Rows.Add(new string[] { "11", "7", "2", "Basketball" });    
    table1.Rows.Add(new string[] { "12", "8", "4", "Soccer" });    
    table1.Rows.Add(new string[] { "14", "3", "5", "Oscar Awards" });    
    table1.Rows.Add(new string[] { "15", "3", "2", "MTV Movie Awards" });
    RadMenu1.DataSource = table1;   
    RadMenu1.DataFieldID = "ID";    
    RadMenu1.DataFieldParentID = "ParentID";    
    RadMenu1.DataTextField = "Text";   
    RadMenu1.DataBind();
}
protected void RadMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)
{    
    DataRowView dataRow = (DataRowView)e.Item.DataItem;    
    e.Item.Attributes["Roles"] = dataRow["Roles"].ToString();
    e.Item.ToolTip = e.Item.Attributes["Roles"];    
    //we set the Tooltip just for testing purposes
}	

See Also

In this article
See Also
Not finding the help you need?
Contact Support