We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How do I add PopupMenuItems in grid at runtime.

Thread ID:

Created:

Updated:

Platform:

Replies:

53472 Dec 14,2006 01:05 AM Dec 14,2006 02:06 AM Windows Forms 1
loading
Tags: GridControl
Ravi
Asked On December 14, 2006 01:05 AM

Hi,

I have added a PopupMenuItems in a data grid at runtime based on the data from database. I need to do different activities for different PopupMenuItems click event. How can i do this?

Here is the code which I wrote, but the problem is how can I identify which barItem is clicked when "barItem_Click" event is fired.

BarItems barItems = new BarItems;
for (int i = 1; i <= 5; i++)
{
BarItem b = new BarItem();
b.Text = i.ToString();
b.Checked = true;
b.Click += new EventHandler(barItem_Click);
barItems.Add(b);
}
grid.PopupMenuItems = barItems;

Thanks,
-Ravi.

Administrator [Syncfusion]
Replied On December 14, 2006 02:06 AM

Hi Ravi,

Use the Name/Text property to find the BarItem in a BarItem.Click event. Here is a code snippet

private void barItem_Click(object sender, System.EventArgs e)
{
BarItem b = sender as BarItem;
if( b.Name == "barItem1")
{
MessageBox.Show("BarItem[1] is Clicked");
}
}

Best Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;