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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Trying to override the saving of a combobox cell in GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

53531 Dec 14,2006 09:25 PM UTC Dec 15,2006 05:39 AM UTC WinForms 1
loading
Tags: GridControl
Eric Castillo
Asked On December 14, 2006 09:25 PM UTC

I had a table with an int column that represents an Id. In lieu of displaying a drop down of Ids, I want to display a list of strings that describe what the Ids represent. I've overriden the QueryCellStyleInfo and SaveCellFormattedText event handlers to try to deal with this, but for some reason, the changes don't persist when I click out of the cell I'm editing. Any ideas?

Thanks!

Eric

Test63.zip

Administrator [Syncfusion]
Replied On December 15, 2006 05:39 AM UTC

Hi Eric,

Use the ValueMember and DisplayMember property of the ComboBox cell to resolve this. Here is a code snippet to show this.

DataTable comboTable = new DataTable("DropDownCombo");
comboTable.Columns.Add("ID",typeof(int));
comboTable.Columns.Add("Item",typeof(string));

for(int i = 0 ;i <5;i++)
{
DataRow dr= comboTable.NewRow();
dr[0] = i;//ValueMember value..
dr[1] = "Item" + i;//DisplayMemberValue
comboTable.Rows.Add(dr);
}
comboTable.AcceptChanges();

gridGroupingControl1.TableDescriptor.Columns["Id1"].Appearance.AnyRecordFieldCell.CellType = "ComboBox";
gridGroupingControl1.TableDescriptor.Columns["Id1"].Appearance.AnyRecordFieldCell.DataSource = comboTable;
gridGroupingControl1.TableDescriptor.Columns["Id1"].Appearance.AnyRecordFieldCell.ExclusiveChoiceList = true;

//That hold the cell text to be displayed in a cell.
gridGroupingControl1.TableDescriptor.Columns["Id1"].Appearance.AnyRecordFieldCell.DisplayMember = "Item";
//That hold the text to be stored in a cell.
gridGroupingControl1.TableDescriptor.Columns["Id1"].Appearance.AnyRecordFieldCell.ValueMember = "ID";

Here is a modified sample.
ModifiedTest.zip

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.

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

;