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

Array DataSource for checkboxes and GridListControl

I have an array of type object (C#) that I use as the datasource for my grid control. The grid control has TextBoxes, CheckBoxes, and GridListContols. The object array has a string for the TextBox columns, boolean for the CheckBox columns, and string for the GridListControl. However, only the values for the TextBox columns show up. The GridControl does not show the CheckBoxes as checked and the GridListControl is empty. How can I get a datasource to work with CheckBoxes and GridListControls?

5 Replies

AD Administrator Syncfusion Team August 12, 2004 04:58 PM UTC

If you are using a GridDataBoundGrid, then you should add GridBoundColumns to the grid.GridBoundColumns collection, one for each property in the objects that are in your ArrayList datasource of teh grid. For the CheckBox column, set gridBoundColumn1.StyleInfo.CellType = "CheckBox" and set gridBoundColumn1.StyleInfo.CellValueType = typeof(bool). For the GridListControl column, you will need another DataSource that holds whatever data your want to see in the droplist. Then set gridBoundColumn2.StyleInfo.CellType = "GridListControl" and set gridBoundColumn2.StyleInfo.DataSource = ???, and gridBoundColumn2.StyleInfo.DisplayMember = ???, and gridBoundColumn2.StyleInfo.ValueMember = ???


JT James Tran August 12, 2004 05:15 PM UTC

I am not using a GridDataBoundGrid. I am populating an array myself and setting it to the DataSource. Does your instructions still apply?


AD Administrator Syncfusion Team August 12, 2004 06:50 PM UTC

What grid are you using? GridControl does not have a DataSource property. If you want to set a DataSource property, then you have to use either teh GridDataBoundGrid control or the GridGroupingControl. Can you post a sample project showing what you are trying to do? That way, maybe we can suggest a way to do what you want?


JT James Tran August 13, 2004 12:15 PM UTC

Sorry, my mistake. I am not using a data source. I am using Object[,] DataSourceArray = new object[3,3]; ... gridControl1.Model.PopulateValues(GridRangeInfo.Cells(1, 1, 3, 3), DataSourceArray); The columns in the grid control that are TextBox display the value in the DataSourceArray correctly. The columns that are CheckBox do not show up correctly. I assign boolean true/false to the DataSourceArray for the columns that are CheckBoxes.


AD Administrator Syncfusion Team August 13, 2004 01:06 PM UTC

You need to set the Me.grid.ColStyles(2).CellType = "CheckBox" Me.grid.ColStyles(2).CellValueType = GetType(Boolean) Me.grid.ColStyles(2).CheckBoxOptions = New GridCheckBoxCellInfo(True.ToString(), False.ToString(), "", True) if your bool column is in column 2, for example.

Loader.
Live Chat Icon For mobile
Up arrow icon