Default value in a combo box grid cell

hi,
i have a control Grid with Combo Box cells.
the combo Boxes be filled from a Query.
How Can i Define the first item of Drop Down List as a default value for combo Box column?


3 Replies

JJ Jisha Joy Syncfusion Team October 23, 2008 05:33 AM UTC

Hi,

We appreciate your interest in Syncfusion Products.

This can be achieved by handling the TableControlCurrentCellInitializeControlText method of GridGroupingControl. Please refer the code:


this.gridGroupingControl1.TableControlCurrentCellInitializeControlText += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellInitializeControlTextEventHandler(gridGroupingControl1_TableControlCurrentCellInitializeControlText);


void gridGroupingControl1_TableControlCurrentCellInitializeControlText(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellInitializeControlTextEventArgs e)
{
if (e.Inner.ColIndex == 3)
e.Inner.ControlText = sc[0];
}


Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Grid.Windows/Grid_WF_GCComBoBoxInitial/main.htm

Kindly try this and let me know if you need further assistance.

Regards,
Jisha



SB solmaz Bahramian October 26, 2008 09:29 AM UTC

Thanks but I Used GridControl and it doesn't have this event :TableControlCurrentCellInitializeControlText
so what should i do ? please help me.



JJ Jisha Joy Syncfusion Team October 29, 2008 12:22 PM UTC

Hi,

Please use the CurrentCellInitializeControlText event of GridControl.
Please refer the code:


this.gridControl1.CurrentCellInitializeControlText += new Syncfusion.Windows.Forms.Grid.GridCurrentCellInitializeControlTextEventHandler(gridControl1_CurrentCellInitializeControlText);

void gridControl1_CurrentCellInitializeControlText(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellInitializeControlTextEventArgs e)
{

}

Let me know if this helps.

Regards.
Jisha


Loader.
Up arrow icon