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

Array DataSource for checkboxes and GridListControl

Thread ID:

Created:

Updated:

Platform:

Replies:

17599 Aug 12,2004 12:47 PM Aug 13,2004 09:06 AM Windows Forms 5
loading
Tags: GridControl
James Tran
Asked On August 12, 2004 12:47 PM

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 12:58 PM

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 01:15 PM

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 02:50 PM

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 08:15 AM

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 09:06 AM

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.

CONFIRMATION

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.

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.

;