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

Reading bool values back from checkbox cell

Thread ID:





15999 Jul 2,2004 07:01 AM UTC Jul 2,2004 08:08 AM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On July 2, 2004 07:01 AM UTC

If have set a checkbox in a GridControl as follows: Grid[gridRow, (int)ColumnOffsets.ServerSelectedColumn].CellValue = false; Grid[gridRow, (int)ColumnOffsets.ServerSelectedColumn].CellType = "CheckBox"; Grid[gridRow, (int)ColumnOffsets.ServerSelectedColumn].Description = "Select"; Grid[gridRow, (int)ColumnOffsets.ServerSelectedColumn].TriState = false; Initially the CellValue appears to be of type ''bool'' as expected, once the user checks the box, the type changes to ''string'' containing the value "1", setting the CellTypeValue causes the grid to through an internal exception when the cell is checked. Any ideas? Thanks, Philip

Administrator [Syncfusion]
Replied On July 2, 2004 08:08 AM UTC

Your code will only work if Grid is a GridControl. If it is a GridDataBoundGrid, then you either must set these properties on the GridBoundColumn.StyleInfo for the column, or set these properties from within an event like Model.QueryCellInfo or PrepareViewStyleInfo. If you are using a GridControl, try also setting Grid[gridRow, (int)ColumnOffsets.ServerSelectedColumn].CheckBoxOptions = new GridCheckBoxCellInfo(true.ToString(), false.ToString(), "", false); Grid[gridRow, (int)ColumnOffsets.ServerSelectedColumn].CellValueType = typeof(bool); This code assumes you want to actually store bool values true and false into your datasource. If you are storing "1" ann "0", then you should change these lines to: Grid[gridRow, (int)ColumnOffsets.ServerSelectedColumn].CheckBoxOptions = new GridCheckBoxCellInfo("1", "0", "", false); Grid[gridRow, (int)ColumnOffsets.ServerSelectedColumn].CellValueType = typeof(string);


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