I fill a ULTRAGRID with data, which then I want to edit. This grid has a column with a boolean data ("ACTIVE" column).When I load the data, the column appears with a CHECKBOX, which is what I want.At the time I go into edit mode, column data become text ("True" "False").To test only create a form and add an UltraGrid and a UltraButton:Private Sub UltraButton1_Click(sender As System.Object, e As System.EventArgs) Handles UltraButton1.Click Dim dt As New DataTable dt.Columns.Add("NAME", System.Type.GetType("System.String")) dt.Columns.Add("ACTIVE", System.Type.GetType("System.Boolean")) dt.Rows.Add("One", True) dt.Rows.Add("Two", False) dt.Rows.Add("Three", True) dt.Rows.Add("Four", False) dt.Rows.Add("Five", True) UltraGrid1.DataSource = dt Dim _objEdicionCheck As New Infragistics.Win.UltraWinEditors.UltraCheckEditor _objEdicionCheck.Style = EditCheckStyle.Check _objEdicionCheck.Visible = True UltraGrid1.DisplayLayout.Bands(0).Columns("ACTIVE").Style = UltraWinGrid.ColumnStyle.CheckBox Dim ucCheck As New Infragistics.Win.UltraWinEditors.UltraControlContainerEditor Me.Controls.Add(_objEdicionCheck) ucCheck.EditingControl = _objEdicionCheck ucCheck.EditingControlPropertyName = "Checked" UltraGrid1.DisplayLayout.Bands(0).Columns("ACTIVE").EditorComponent = ucCheck End Sub If I edit the column (by double click), the cell becomes in a checkbox.. and when I leave the cell, the columns returns to "True" or "False" Why the column lost the style (EditCheckStyle.Check)?
Hi,
I just wanted to know if you were able to solve your issue based on our suggestions or you still need help? Just let me know.
Thank you.
If you bind the grid to a data source with a boolean column, the grid will display that column as a checkbox.
So why are you jumping through hoops and writing a bunch of code to use the UltraControlContainerEditor? What you are trying to do is the default behavior of the grid - you do not have to do anything to get what you want.
The reason the field is changing to text is because you only specified the EditingControl of the UltraControlContainerEditor. This only affects the cell in edit mode. If you want a checkbox displayed when not in edit mode, you need another UltraCheckEditor as the RenderingControl of the UltraControlContainerEditor.
But, as I said, there is no reason for you to be using the UltraControlContainerEditor at all if you just want the cell to show a checkbox. This functionality is already built-in to the grid.
Hello,
I have reviewed your code and can say that you are using for the editor of the column “ACTIVE” UltraControlContainerEditor, and you have set UltraCheckEditor for EditingControl (http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.v11.1~Infragistics.Win.UltraWinEditors.UltraControlContainerEditor~EditingControl.html ) of the UltraControlContainerEditor. That is why when you enter in edit mode of the cell, you are seeing a check box. For the RendaringControl (http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.v11.1~Infragistics.Win.UltraWinEditors.UltraControlContainerEditor~RenderingControl.html )you haven’t assigned a value and that is why you are seeing the text representation of the underlying value. If you want to correct this you should set instance of UltraCheckEditor for RendaringControl of the UltraControlContainerEditor. If you have a Boolean column in your underlying dataset, UltraGrid automatically will display this column as a checkbox column and you shouldn’t add any other editors.
Please let me know if you have any further questions .
Mike
I want always show a check box, both in edit mode and in read-only mode
I have a new example form:
When I press "Load Data", grid show results as follow:
After I want to edit this results. I press "Edit" and the column changes to Text..Why?
But when I click over the column to edit, the column become a checkbox.
The code of this new form is
Private Sub Edit_Click(sender As System.Object, e As System.EventArgs) Handles Edit.Click 'Allow to edit UltraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.True 'Create the ControlContainer Dim ucCheck As New Infragistics.Win.UltraWinEditors.UltraControlContainerEditor 'Create the editor object Dim _objEditionCheck As New Infragistics.Win.UltraWinEditors.UltraCheckEditor _objEditionCheck.Style = EditCheckStyle.Check ucCheck.EditingControl = _objEditionCheck ucCheck.EditingControlPropertyName = "Checked" UltraGrid1.DisplayLayout.Bands(0).Columns("ACTIVE").EditorComponent = ucCheck End Sub Private Sub LoadData_Click(sender As System.Object, e As System.EventArgs) Handles LoadData.Click Dim dt As New DataTable dt.Columns.Add("NAME", System.Type.GetType("System.String")) dt.Columns.Add("ACTIVE", System.Type.GetType("System.Boolean")) dt.Rows.Add("One", True) dt.Rows.Add("Two", False) dt.Rows.Add("Three", True) dt.Rows.Add("Four", False) dt.Rows.Add("Five", True) 'Force the grid to be readonly UltraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False UltraGrid1.DataSource = dt End Sub
Thx
I don't understand what you are trying to do here.
Are you saying that you want the cell to show a CheckBox all the time? Or you only want it to show a CheckBox when it is in edit mode?
When do you want a CheckBox and when do you want text?
The Style property of the column just assigns a default editor to that column. Once you assign an Editor to that column, you are basically overriding the Style property so Style no longer has any effect. So there is no reason to set both.