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

set the source of a combobox which is in a cell of datagrid

hi i am trying to set the source of a combobox cell of grid control gridControl1[rowIndex, colIndex + 2].ChoiceList = items; i have a string array which needs to be converted to Collections.Specialized.StringCollection can someone help me with this conversion or is there a way so that i can directly set the source of the combobox cell in gridcontrol thanks Shri

1 Reply

AD Administrator Syncfusion Team September 3, 2004 10:43 PM UTC

You mentioned datagrid in your subject, but the code you show is for a GridControl. You cannot set cell properties (other than CellValue or Text) on individual cells in a GridDataBoundGrid. Normally, in a GridDataBoundGrid you set the style properties on the whole column as described in this KB. http://www.syncfusion.com/Support/article.aspx?id=562 If you want a single cell to have a special property set, then you would either have to handle grid.Model.QueryCellInfo or grid.PrepareViewStyleInfo and set the property dynamically in one of those events as described in this KB. http://www.syncfusion.com/Support/article.aspx?id=562 To add a string[] myArrayOfStrings to a StringCollection sc, you would used code like: sc.AddRange(myStrings); //myStrings is declared as string[] myStrings; If you look at the grid\samples\cellttypes\comboboxes sample that we ship, you can see code that sets up a ChoiceLisr for use in a combobox cell. This sample uses a GridControl, but the same type of style setting should work for a GridBoundColumn.StyleInfo in a GridDataBoundGrid.

Live Chat Icon For mobile
Up arrow icon