Dynamic menu item in rad menu

2 posts, 0 answers
  1. Ramakrishnan
    Ramakrishnan avatar
    1 posts
    Member since:
    Dec 2010

    Posted 20 Dec 2010 Link to this post

    Hi to All,

    I want to generate dynamic menuitems instead of menuitems placed in Rad menu example
    How to implement this?

    Thanks
    Ramakrishnan t
  2. msigman
    msigman avatar
    141 posts
    Member since:
    Apr 2008

    Posted 26 Dec 2010 Link to this post

    class SearchTemplate : ITemplate
    {
        public void InstantiateIn(Control container)
        {
            RadTextBox textbox = new RadTextBox();
            textbox.EmptyMessage = "Search";
            textbox.Width = 200;
            textbox.ShowButton = false;
            textbox.Style.Add("margin-left", "10px");
            textbox.Style.Add("margin-right", "0px");
            container.Controls.Add(textbox);
            Image img = new Image();
            img.ImageUrl = "~/search-ltr.png";
            img.CssClass = "SearchButton";
            container.Controls.Add(img);
        }
    }

    protected void Page_Init(object sender, EventArgs e)
    {
                RadMenuItem search = new RadMenuItem();
                search .ItemTemplate = new Search();
                RadMenu1.Items.Add(search );
    }
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top