Hi,
In GridControl I am binding a combox box with values from a stringcollection during runtime. But the selected values becomes blank once I moved to other cell or row, and I am not getting the selected value. I am using Virtual grid and the version is Syncfusion 2.0.5.1 Suite.
AD
Administrator
Syncfusion Team
September 12, 2006 04:39 AM UTC
Hi shankar,
In a virtual grid, all individual style properties have to be provided on demand in the QueryCellInfo handler. If individual cell styles could be stored in a virtual grid, this would defeat the purpose of the virtual grid which is to not store any infomation in the individual cells, but instead provide all these properties on demand. By design, Setting individual cell GridStyleInfo properties does not work in a virtual grid.
It is possible to set column properties in a virtual grid. For example, to make column 3 red, you would just use code such as GridControl.ColStyles[3].BackColor = Color.Red;. But this does not set individual cell properties. To set those individual cell properties in a virtual grid, you have to do it in QueryCellInfo. I was able to add a combobox and ChoiceList properties to the virtual grid without a problem. Below is the code segment that I used.
private void gridQueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
if( e.RowIndex > 0 && e.ColIndex ==2)
{
e.Style.CellType = "ComboBox";
e.Style.ChoiceList = new StringCollection();
e.Style.ChoiceList.AddRange( new string[]{"one", "two", "three"});
}
}
Here is a sample.
http://www.syncfusion.com/Support/user/uploads/Gcontrol_c7f569cc.zip
If you cannot spot why yours is not working, if you can send a sample or code snippet showing what you are doing, maybe I can suggest something.
Regards,
Haneef
KG
kgpsan
September 12, 2006 06:56 AM UTC
Haneef
I have done it in the similar way as you have mentioned, but for me it just disappears, am I missing out something.
AD
Administrator
Syncfusion Team
September 12, 2006 07:32 AM UTC
Hi Shankar,
Are you setting the CellValue of the combobox cell in QueryCellInfo event? If yes, you can use the hashtable to store the modified cell value in CurrentCellChanged event and then set the cellvalue of the combobox cell using hashtable in QueryCellInfo event.
Here is a sample for implementing it.
http://www.syncfusion.com/Support/user/uploads/Gcontrol_11d076bb.zip
Thanks,
Haneef
KG
kgpsan
September 12, 2006 08:18 AM UTC
Haneef,
I am not able to get the sample source,which you have uploaded.
AD
Administrator
Syncfusion Team
September 12, 2006 08:30 AM UTC
Hi Shankar,
Sorry for the inconvenience caused.
Here is a link for that sample.
http://www.syncfusion.com/Support/user/uploads/Gcontrol_2140cdd8.zip
Thanks,
Haneef
KG
kgpsan
September 12, 2006 10:06 AM UTC
Haneef,
Thanks for the sample application, I am able to understand the place where i am getting it wrong, But now i am struck with different issue, I have created a wrapper for the Gridcontrol, which is at a different layer (The queryinfo is being implemented in this class) and this Wrappered GridControl will be used by different UI, so my column''s will be different in each UI and I will not be able to handle the issue like how you have shown in your sample.
Why is that I am not able to have the changed data, I am using Gridstyleinfo, but when i see in the querycellinfo, the gridstyleinfo is not holding the changed data. Could you please help me this regard.