New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Data Bindings

  • File
    • New
    • Open
    • Save
    • Save As
    • Print Preview
    • Print
    • Close
  • Edit
    • Undo
    • Cut
    • Copy
    • Paste
    • Clipboard...
  • Insert
    • Break...
    • Page Numbers...
    • Date and Time...
    • Field...
    • Symbol...
    • Comment
    • Picture
    • Diagram
    • Hyperlink

The DataBindings collection lets you provide different sets of data bindings to the items on different levels of the menu. You can even bind the menu items on each level of the menu from different tables in a DataSet.


This example demonstrates how to use databindings to apply declarative mapping of data fields to menu item properties.

<telerik:RadMenu runat="server" ID="RadMenu1" DataSourceID="XmlDataSource1" DataFieldID="id"
	DataFieldParentID="parentID">
	<DataBindings>
		<telerik:RadMenuItemBinding TextField="Text" />
		<telerik:RadMenuItemBinding Depth="1" ImageUrlField="ImageUrl" TextField="Text" />
	</DataBindings>
</telerik:RadMenu>
<asp:XmlDataSource runat="server" ID="XmlDataSource1" DataFile="Menu.xml" XPath="/Menu/MenuItem" />
  • DefaultCS.aspx
  • styles.css
  • Menu.xml
<%@ Page  %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
</head>

<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />

    <div class="demo-container size-thin">
        <telerik:RadMenu RenderMode="Lightweight" runat="server" ID="RadMenu1" DataSourceID="XmlDataSource1" DataFieldID="id"
            DataFieldParentID="parentID" EnableRoundedCorners="true" EnableShadows="true">
            <DataBindings>
                <telerik:RadMenuItemBinding Depth="0" TextField="Text" CssClass="rootItems" />
                <telerik:RadMenuItemBinding Depth="1" ImageUrlField="ImageUrl" TextField="Text" />
            </DataBindings>
        </telerik:RadMenu>
    </div>

    <asp:XmlDataSource runat="server" ID="XmlDataSource1" DataFile="Menu.xml" XPath="/Menu/MenuItem"></asp:XmlDataSource>

    </form>
</body>
</html>

Support & Learning Resources

Find Assistance