RadDropDownButton ?

4 posts, 0 answers
  1. Deasun
    Deasun avatar
    13 posts
    Member since:
    Jan 2017

    Posted 06 Sep 2018 Link to this post

    In design time I have added one of these to my form.

    And added items to it thru the UI.

    Now I want to capture when the user clicks on one of them items.

    How to I do that? Not seeing an event for it. Only for the button click which fires off even when you don't click on one of the items.

    Sorry tis late and the office is hot, I am just not seeing it.

    Thanks in advance.

    Deasun.

     

  2. Dimitar
    Admin
    Dimitar avatar
    2823 posts

    Posted 07 Sep 2018 Link to this post

    Hello Deasun,

    Each menu item has its own Click event. Here is how to use it:
    public RadForm1()
    {
        InitializeComponent();
     
        radMenuItem1.Click += RadMenuItem1_Click;
    }
     
    private void RadMenuItem1_Click(object sender, EventArgs e)
    {
         
    }

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Deasun
    Deasun avatar
    13 posts
    Member since:
    Jan 2017

    Posted 07 Sep 2018 in reply to Dimitar Link to this post

    So I have to create the click event link for each item in the dropdown list?

    Just want to be sure.

    radMenuItem1.Click += RadMenuItem1_Click;

    So If I have 7 items I need 7 of these?

    as such: radMenuItem2.Click += RadMenuItem2_Click;

    radMenuItem3.Click += RadMenuItem3_Click;

    and so on?

     

  4. Dimitar
    Admin
    Dimitar avatar
    2823 posts

    Posted 10 Sep 2018 Link to this post

    Hi Deasun,

    Yes, this is correct. 

    It is possible however to use the same event handler and check the text. Here is an example:
    public RadForm1()
    {
        InitializeComponent();
        radMenuItem1.Click += RadMenuItem1_Click;
        radMenuItem2.Click += RadMenuItem1_Click;
    }
     
    private void RadMenuItem1_Click(object sender, EventArgs e)
    {
        var item = sender as RadMenuItem;
        if (item.Text == "radMenuItem1")
        {
     
        }
    }

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top