Accessing ContentTemplate from code

2 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 30 Mar 2015 Link to this post

    This works for ItemTemplate:

    http://www.telerik.com/help/aspnet-ajax/menu-templates-accessing-controls.html

    But how can I access the ContentTemplate for a menu item from code?

    Marc
  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 01 Apr 2015 Link to this post

    Hello,

    The controls placed in a RadMenuItem ContentTemplate can be accessed by their ID, as shown below:
    <telerik:RadMenu ID="RadMenu1" runat="server" Width="450">
        <Items>
             <telerik:RadMenuItem Text="Root1">
                <ContentTemplate>
                    <telerik:RadButton runat="server" ID="Button1"></telerik:RadButton>
                </ContentTemplate>
            </telerik:RadMenuItem>
        </Items>
    </telerik:RadMenu>

    protected void Page_Load(object sender, EventArgs e)
    {
        Button1.Text = "NewText";
    }

    Regards,
    Ivan Danchev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top