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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Array DataSource for checkboxes and GridListControl

Thread ID:





17599 Aug 12,2004 04:47 PM UTC Aug 13,2004 01:06 PM UTC WinForms 5
Tags: GridControl
James Tran
Asked On August 12, 2004 04:47 PM UTC

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?

Administrator [Syncfusion]
Replied On 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 = ???

James Tran
Replied On 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?

Administrator [Syncfusion]
Replied On 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?

James Tran
Replied On 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.

Administrator [Syncfusion]
Replied On 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.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon