User (Old forums)MemberJune 11, 2009 at 7:28 pmPost count: 23064
I have a insertionrow on my grid, one of the columns is boolean type, I want to set the insertioncell, of boolean type, to false ( so I don’t get the green square in the checkbox). How can I do this?
thanks in advance
Imported from legacy forums. Posted by email@example.com (had 1579 views)User (Old forums)MemberJune 15, 2009 at 4:06 pmPost count: 23064
you can do like this :
Private Sub myGrid_AddingDataRow(ByVal sender As System.Object, ByVal e As Xceed.Grid.AddingDataRowEventArgs) Handles myGrid.AddingDataRow
If IsDBNull(e.DataRow.Cells(“myColumn”).Value) Then e.DataRow.Cells(“ID_myColumn”).Value = false
Imported from legacy forums. Posted by Daniel (had 241 views)User (Old forums)MemberJune 15, 2009 at 5:00 pmPost count: 23064
The previous answer won’t clear the checkbox on the InsertionRow. It will still appear as a full green square. To get rid of this green square, here is a possibility:
include Xceed.Grid.Editors and Xceed.Grid.Viewers in your project, include this in your Form1.vb
and, it your Form1 class:
Public Sub New()
Xceed.Grid.Licenser.LicenseKey = “(your license key here)”
gridControl1.SingleClickEdit = True ‘ change a checkbox value with a single click even if it’s not already selected, takes two clicks otherwise
If insertionRow1 IsNot Nothing AndAlso insertionRow1.Cells(1) IsNot Nothing Then
insertionRow1.Cells(“column2”).CellEditorManager = New CheckBoxEditor()
insertionRow1.Cells(“column2”).CellViewerManager = New CheckBoxViewer()
CType(insertionRow1.Cells(“column2”), InsertionCell).IdleValue = False ‘ The idle value is what you see when the insertion row is not activated yet
and you will also need this to put the IdleValue of the InsertionCell into the row that is being added:
Private Sub gridControl1_AddingDataRow(ByVal sender As Object, ByVal e As AddingDataRowEventArgs) Handles gridControl1.AddingDataRow
e.DataRow.Cells(“column2”).Value = (CType(insertionRow1.Cells(“column2”), InsertionCell)).IdleValue
In a certain way, the insertion row is a template for the rows that will be added, as long as it is not activated. It becomes activated when one of the IdleValues is changed. The IdleValue is not automatically transfered in the Value field. In the example above, I took for granted that your grid was named gridControl1, the column with the boolean value was “column2” and the insertion row was insertionRow1. If your instances have different names, do the changes as needed.
Imported from legacy forums. Posted by Ghislain (had 1548 views)
- You must be logged in to reply to this topic.