Hello,
My ComboBox-cells give problems in my Grid after upgrading from version 2.1.0.9 to version 3.2.1.0
I have 2 problems with my ComboBox cells in a grid after the upgrade:
1 The value a cell shows is not anymore what I expected but the formname + ValueMemberName.
The font that''s used is also a little bit strange (shaded ?).
2 clicking on a cell doesn''t show the list of possible values
This is the code I use for defining the cell:
GridControl[1,1].CellType = "ComboBox";
GridControl[1,1].DropDownStyle = GridDropDownStyle.Exclusive;
GridControl[1,1].Trimming = System.Drawing.StringTrimming.EllipsisCharacter;
GridControl[1,1].DataSource = lDataSource;
GridControl[1,1].DisplayMember = "Contract";
GridControl[1,1].ValueMember = "ContractItem";
The property Contract of a ContractItem returns a string;
lDataSource is an ArrayList of ContractItem-objects
Can someone tell me what I do wrong ?
With regards,
Eric van Dinter
AD
Administrator
Syncfusion Team
June 17, 2005 03:12 PM UTC
I suspect there may be a exception being thrown. Just your output window when you run in debug. Are you setting the initial values in cell 1,1 to be valid ContractItem values, (ie, have the same type). For example, if ContractItem is an integer, then are you setting grid[1,1].Cellvalue to an iteger (maybe grid[1,1].CellValueType = typeof(int) ).
AD
Administrator
Syncfusion Team
June 20, 2005 10:06 AM UTC
Hello Clay,
I don''t get the impression that an exception occurred. How can I be sure of it ?
I set the value of the cell with the following code:
foreach(ContractItem lItem in lDataSource)
{
if (lItem.Contract == lContract)
{
GridControl[1,1].CellValue = lItem;
break;
}
}
When I add the code:
GridControl[1,1].CellValueType = typeof(ContractItem);
I still get the same result
AD
Administrator
Syncfusion Team
June 20, 2005 10:20 AM UTC
You can run your application in debug mode with the debugger set to break on exceptions. (Use the Debug/Exceptions menu item. In the dialog, click Common Language Runtime exceptions in the top box, and then click the Break into the Debugger option underneath it.)
Is the Contract value a string, or is it an object you have defined through a class. If if is an object, did you override ToString to display what you want seen here?
If you can upload a sample project showingthe porblem, we can try to debug it here.
AD
Administrator
Syncfusion Team
June 20, 2005 12:58 PM UTC
Hi Clay,
I added the ToString method and now the right text is shown.
I thought that it would be set by DisplayMember ?
But I still have the problem that font is strange and clicking does not have any effect.
So hereby I send you a little project showing the problem.
Eric
AD
Administrator
Syncfusion Team
June 20, 2005 12:59 PM UTC
Here''s the project
AD
Administrator
Syncfusion Team
June 20, 2005 01:01 PM UTC
TestComboBox_106.zip
This time I hope ! ;-)
AD
Administrator
Syncfusion Team
June 20, 2005 02:18 PM UTC
Try setting the ValueMember to null.
gridControl1[1,1].ValueMember = null;
This will tell the gri dthat you want to use the item itself as teh value (and not a property of teh item).
AD
Administrator
Syncfusion Team
June 20, 2005 02:46 PM UTC
Yep !
That does the trick.
Thanx for your support !!
Eric