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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Checkbox Stops Working When GridBaseStyles are Changed

Thread ID:





88878 Aug 13,2009 08:02 PM UTC Aug 27,2009 11:51 PM UTC WinForms 5
Tags: GridControl
Administrator [Syncfusion]
Asked On August 13, 2009 08:02 PM UTC

I'm using the GridDataBoundGrid with checkbox columns. I've found that when I change any GridBaseStyle in BaseStylesMap, the checkbox columns stop working. Why does this happen, and what can I do to make it work?

This is an example of how I initialize a checkbox column:

'Initialize ShowProgressChartColumn.
ShowProgressChartColumn = New GridBoundColumn
With ShowProgressChartColumn
.HeaderText = "Show Progress Chart"
.MappingName = "ShowProgressChart"
.StyleInfo.CellType = GridCellTypeName.CheckBox
.StyleInfo.CellValueType = GetType(System.Boolean)
.StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Center
End With

This is how I change the GridBaseStyles:

Public Sub New()

'Loop through all base styles (Header, Row Header, Column Header, and Standard).
For Each GridBaseStyle As GridBaseStyle In BaseStylesMap

'Apply the standard font to this style.
With GridBaseStyle.StyleInfo.Font
.Facename = Globals.Facename
.Size = Globals.FontSize
End With


End Sub

Can anyone spot what I'm doing wrong? All advice is appreciated.


Administrator [Syncfusion]
Replied On August 16, 2009 05:32 PM UTC

Okay, I still haven't found a solution to this -- it has turned into one of those frustrating little bugs that consumes hours. I've been experimenting with various properties of the grid, and I can't find an approach that works.

No one has answered my original post yet, so I'm going to rephrase the question in a way that might be more likely to get a reply: Can anyone provide me with an example that changes the font for a grid, yet preserves the functionality of checkbox columns?

Rajadurai C [Syncfusion]
Replied On August 17, 2009 01:52 PM UTC

Hi TC,

Thanks for your interest in Syncfusion Products.

I have tried to reproduce the issue with checkbox in a sample with the code settings provided. But it works fine. On analysing the issue reported, it seems the name of the column binded to grid to which the checkbox column has been mapped is not given properly in your application. Only then, you cannot make any changes in the checkbox. Please refer to the following sample in which the grid is binded with datatable. A gridboundcolumn with checkbox celltype is added and binded to the first column of binded datasource.

If you still sees the issue, please try to reproduce it in the attached sample and provide us. It would be fine to see the issue and work to provide a better solution.


Administrator [Syncfusion]
Replied On August 18, 2009 05:38 PM UTC


Thank you for the help. I appreciate the effort you spent to prepare sample code for me.

I've experimented further, and I've observed that the bug occurs whenever a GridBaseStyle is changed before the GridDataBoundGrid is added to a Controls collection. Please see the attached code for an example.

I was able to work-around the problem by setting the GridBaseStyles not in the New procedure, but in an Initialize override. Everything works fine now.



Rajadurai C [Syncfusion]
Replied On August 19, 2009 11:14 AM UTC

Hi TC,

Thanks for your details.

In the provided sample, please try to call a method InitializeLifetimeService() of GridBoundColumns in constructor of CustomGrid class before setting base styles. This method initializes an object that refers to the instance of GridBoundColumns from here until its lifetime.


Here is the modified sample for your reference in which this has been implemented solving the issue with checkbox celltype column.


Administrator [Syncfusion]
Replied On August 27, 2009 11:51 PM UTC


Thanks for your help. I've changed my code to use InitializeLifetimeService, and it is working great.



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

or the page will be automatically redirected to 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