Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1005
CheckBox menu in WebDataMenu control
posted

Hi!

  please, see atached image. I am migrating from UltraWebMenu to WebDataMenu control. I want to accomplish (by code) to have a checkbox menu item like the one in the image, is that possible?

 

thanks,

Fernando

Parents
  • 37874
    posted

    Hi Fernando,

    You can achieve this using item templates. Here is a sample code which will add checkbox to the first root menu item:

    public partial class _Default : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            WebDataMenu1.Items[0].Template = new CustomItemTemplate();

        }

    }

     

    public class CustomItemTemplate : ITemplate

    {

        public void InstantiateIn(Control container)

        {

            CheckBox cb = new CheckBox();

            cb.Text = "Check";

            container.Controls.Add(cb);

        }

    }

    Please let me know if you have any questions.

Reply Children