how search Menu items

2 posts, 0 answers
  1. Sigma
    Sigma avatar
    87 posts
    Member since:
    Apr 2012

    Posted 11 Jun 2012 Link to this post

    how search  Menu items 
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 22 Nov 2012 Link to this post

    Hi,

    I suppose you want to search a RadMenuItem based on the text entered in a TextBox. Following is the sample code.

    ASPX:
    <telerik:RadMenu ID="RadMenu1" runat="server">
        <Items>
            .....
        </Items>
    </telerik:RadMenu>
    <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="true" ontextchanged="TextBox1_TextChanged">
    </asp:TextBox>

    C#:
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        Response.Write(RadMenu1.GetAllItems().Count);
        foreach (RadMenuItem item in RadMenu1.GetAllItems())
        {
            if (TextBox1.Text == item.Text)
            {
                item.Selected = true;
            }
        }
    }

    Hope this helps.

    Regards,
    Princy.
Back to Top