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. Image for the cookie policy date

setting Default values for bound combo box Columns.

hi;
i used a Control Grid with ComboBox columns.they are bound to a Query.and they fill during load_Form .how can i set the first item as a Default values in combo box Columns.Now they load with Blank item.



1 Reply

RC Rajadurai C Syncfusion Team October 22, 2008 06:48 AM UTC

Hi Shayesteh,

Thanks for your interest in Syncfusion products.

The default values can be set for a ComboBox cell by using its Text property. Please check out the sample code snippet below.



string[] desig = {"Operator","Supervisor","Engineer","Developer","Manager"};

private void Form1_Load(object sender,EventArgs e)
{
this.gridControl1.PopulateValues(GridRangeInfo.Cells(1,1,5,2),CreateTable());
for(int i=0;i {
this.gridControl1.ColWidths[3]=90;
this.gridControl1[i+1,3].CellType="ComboBox";
this.gridControl1[i+1,3].DataSource=CreateTable();
this.gridControl1[i+1,3].DisplayMember="Designation";
this.gridControl1[i+1,3].Text=desig[i];
}
}

Here is a minimal sample.
http://websamples.syncfusion.com//samples/Grid.Windows/F77216/main.htm

Regards,
Rajadurai



Loader.
Live Chat Icon For mobile
Up arrow icon