RadMenu for ASP.NET AJAX

RadControls for ASP.NET AJAX

If your RadMenu has items with templates that have embedded controls, you may want to access the properties of those embedded controls. To get a reference to the embedded control, locate the RadMenuItem that has the template, and use its FindControl method.

For example, consider the following, very simple, menu:

CopyASPX
<telerik:RadMenu ID="RadMenu1" runat="server" Flow="Horizontal">
    <Items>
        <telerik:RadMenuItem runat="server" ExpandMode="ClientSide" Text="Color">
            <Items>
                <telerik:RadMenuItem runat="server" ExpandMode="ClientSide" Text="ColorPicker">
                    <ItemTemplate>
                        <telerik:RadColorPicker ID="RadColorPicker1" runat="server" Preset="Standard" ShowEmptyColor="False">
                        </telerik:RadColorPicker>
                    </ItemTemplate>
                    <GroupSettings ExpandDirection="Auto" Flow="Vertical" />
                </telerik:RadMenuItem>
            </Items>
            <GroupSettings ExpandDirection="Auto" Flow="Vertical" />
        </telerik:RadMenuItem>
    </Items>
</telerik:RadMenu>

To access the RadColorPicker in the item template, use the following code:

  • Server-side access

  • Client-side access

CopyJavaScript
var menu = $find("<%= RadMenu1.ClientID %>");var item = menu.findItemByText("ColorPicker");var datePicker = item.findControl("RadColorPicker1");            

or

CopyJavaScript
var datePicker = $find('<%= RadMenu1.FindItemByText("ColorPicker").FindControl("RadColorPicker1").ClientID %>');          

See Also

Other Resources