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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How would implement a More.. option in a grid combo box

Thread ID:

Created:

Updated:

Platform:

Replies:

68701 Sep 27,2007 06:28 PM UTC Dec 31,2007 08:03 PM UTC WinForms 3
loading
Tags: Grouping
Shane
Asked On September 27, 2007 06:28 PM UTC

I'm using a Grid Grouping control and I have set the CellType for some of the cells to "ComboBox" but now I want to add a "More..." option to the bottom of the list. When this is selectd a dialog should be launched and the value returned from this should be used.
Also if the the cancel button is pressed on the dialog it needs to cancel the edit.

How would I go about do this

Thanks
Shane.

haneefm [Syncfusion]
Replied On October 2, 2007 06:08 PM UTC

Hi Shane,

You can handle the CurrentCellShowingDropDown event of the grid and add the More option in DropDownList using the ListBoxPart.Items.Add method. Also you can handle the ListBoxPart.MouseDown event to popup your custom dialogbox to set your value in a cell. Below are the codes that show this task.

private void gridControl1_CurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellShowingDropDownEventArgs e)
{
GridComboBoxCellRenderer cr =(GridComboBoxCellRenderer) this.gridControl1.CurrentCell.Renderer;
if(cr!=null)
{
if (!cr.ListBoxPart.Items.Contains("More..."))
cr.ListBoxPart.Items.Add("More...");
cr.ListBoxPart.MouseDown += new MouseEventHandler(ListBoxPart_MouseDown);
}
}

void ListBoxPart_MouseDown(object sender, MouseEventArgs e)
{
ListBox listPart = sender as ListBox;
if (listPart.SelectedItem.Equals("More..."))
{
MessageBox.Show("More Options is selected, Please Popup your own UserDialog","User Notification");
}
}

void gridControl1_CurrentCellCloseDropDown(object sender, Syncfusion.Windows.Forms.PopupClosedEventArgs e)
{
GridComboBoxCellRenderer cr = (GridComboBoxCellRenderer)this.gridControl1.CurrentCell.Renderer;
if (cr != null)
{
cr.ListBoxPart.MouseDown -= new MouseEventHandler(ListBoxPart_MouseDown);
}
}

Best regards,
Haneef

Shane
Replied On October 11, 2007 03:54 PM UTC

The events CurrentCellShowedDropDown and CurrentCellShowingDropDown aren't firing. Do I need to set something to activate these events?

>Hi Shane,

You can handle the CurrentCellShowingDropDown event of the grid and add the More option in DropDownList using the ListBoxPart.Items.Add method. Also you can handle the ListBoxPart.MouseDown event to popup your custom dialogbox to set your value in a cell. Below are the codes that show this task.

private void gridControl1_CurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellShowingDropDownEventArgs e)
{
GridComboBoxCellRenderer cr =(GridComboBoxCellRenderer) this.gridControl1.CurrentCell.Renderer;
if(cr!=null)
{
if (!cr.ListBoxPart.Items.Contains("More..."))
cr.ListBoxPart.Items.Add("More...");
cr.ListBoxPart.MouseDown += new MouseEventHandler(ListBoxPart_MouseDown);
}
}

void ListBoxPart_MouseDown(object sender, MouseEventArgs e)
{
ListBox listPart = sender as ListBox;
if (listPart.SelectedItem.Equals("More..."))
{
MessageBox.Show("More Options is selected, Please Popup your own UserDialog","User Notification");
}
}

void gridControl1_CurrentCellCloseDropDown(object sender, Syncfusion.Windows.Forms.PopupClosedEventArgs e)
{
GridComboBoxCellRenderer cr = (GridComboBoxCellRenderer)this.gridControl1.CurrentCell.Renderer;
if (cr != null)
{
cr.ListBoxPart.MouseDown -= new MouseEventHandler(ListBoxPart_MouseDown);
}
}

Best regards,
Haneef

J.Nagarajan [Syncfusion]
Replied On December 31, 2007 08:03 PM UTC

Hi Shane ,

Sorry for the delay in getting back to you.

CurrentCellShowingDropDown event gets fired when the Combobox's DropDown is showing and CurrentCellShowedDropDown event gets fired after the expand the dropdown. Please refer to the attahced sample.

http://websamples.syncfusion.com/samples/Grid.Windows/F68701/main.htm

In this smaple both CurrentCellShowingDropDown and CurrentCellShowedDropDown events fired properly.

Please let me know if you have any other questions.

Regards,
Nagaraj


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.

Warning Icon 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.Close Icon

;