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 to select a item in a GridControl combobox

Thread ID:

Created:

Updated:

Platform:

Replies:

60616 May 9,2007 06:45 AM May 11,2007 02:39 AM Windows Forms 4
loading
Tags: GridControl
Jerry
Asked On May 9, 2007 06:45 AM

Hi

I have a gridcontrol where one of the cells is defined as a CellType = "ComboBox" and filled with a choicelist. I have no problem with selection of an item by clicking on it.
But how can I programmaticially select a item in the box, and how can I find the selected item?

Thanks

Jerry

haneefm [Syncfusion]
Replied On May 9, 2007 10:45 AM

Hi Jerry,

To set and get the selected item on the combobox cell in a grid , just try the following code

//set
this.gridControl[row,col].CellValue="Text";
//get
Label1.text=this.gridControl[row,col].FormattedText;

Here is a KB Article discuss with the simillar issue.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=233

Thanks for choosing our Syncfusion products.

Best regards,
Haneef

Jerry
Replied On May 10, 2007 04:35 AM

Hi Haneef

And thanks for the answer that helped.
I have a question more. Which event should I use when I want to be notified when the user has changed the value in the ComboBox.

Regards

Jerry

haneefm [Syncfusion]
Replied On May 10, 2007 06:58 PM

Hi Jerry,

To detect combobox cell changes in a grid, you need to handle the CurrentCellChanged event. Here is a code snippet.

//CurrentCellChanged event
[c#]
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
if( grid.Model[cc.RowIndex, cc.ColIndex].CellType == "ComboBox" )
{
Console.WriteLine("ComboBox cell changed");
}

Let me know if this helps.

Best regards,
Haneef

Jerry
Replied On May 11, 2007 02:39 AM

Hi Haneef

That worked, so thanks a lot for your help.

Best regards

Jerry

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.

;