How to associate an event with a menu item in a split button?

Answered
0
0

I created a splitbutton with menuitems as a collection. How to associate an event with a menu item in a split button? because nothing happens when I click on the selected menu item.  I tried adding this .

namespace Views
{
public partial class Views : Views.Paneles.ViewBase
{

public View()
{
InitializeComponent();
this.splitButton1.ItemClicked += splitButton1_ItemClicked;
}

private void splitButton1_ItemClicked(object sender, MenuButtonItemClickedEventArgs e)
{
AlertBox.Show(“SplitButton Item”);
}

}

}

  • You must to post comments
Best Answer
0
0

You are using LinkMenuItem instead of MenuItem without an HRef. LinkMenuItems create navigation links. Use the default MenuItems and it will work fine.

  • guadalupe
    ok, thankyou
  • You must to post comments
0
0

Hi,

can you please create a complete test case so we can inspect that issue.
With your details we could not yet reproduce it.

Thanks in advance.

Best regards
Frank

  • guadalupe
    Hi, I have a page with a splitbutton, this have menuitems as a collection. But when I clic in the opción of the menuitem nothing happens. What I doing bad? I have this code:        using System;        using Wisej.Web;        namespace ProjectWiseJ        {              public partial class cobranza : Page                {                public cobranza()                  {                     InitializeComponent();                   }                   private void cobranza_Load(object sender, EventArgs e)                      {                            splitButton1.ItemClicked += new MenuButtonItemClickedEventHandler(splitButton1_ItemClicked);                       }                        private void splitButton1_ItemClicked(object sender, MenuButtonItemClickedEventArgs e)                         {                              AlertBox.Show(“SplitButton Item”);                         }              }           } Nothing happens when I click on the selected menu item. Am I missing something?
  • Luca (ITG)
    It works well. Do you have a sample application that shows your code? The one you pasted works for us.
  • guadalupe
    Yes, in the answer below I add the sample.
  • You must to post comments
0
0

Hi,

this is my sample, where it does not work when I click on a splitbutton item.

  • You must to post comments
0
0

You are using LinkMenuItem instead of MenuItem without an HRef. LinkMenuItems create navigation links. Use the default MenuItems and it will work fine.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.