I'm having an issue when I add a checkbox column to my datagrid. I am adding the column during the InitializeLayout event. The problem is, when the form loads, all the checkboxes in the checkbox column are completely filled in. Am I doing something wroing? Here is the code I am currently using in the InitializeLayout Event and a picture to show what is going on. Thanks. -Ted
Dim checkColumn As UltraGridColumn = e.Layout.Bands(0).Columns.Add("Batch", "Batch") checkColumn.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox checkColumn.CellActivation = Activation.AllowEdit checkColumn.Header.VisiblePosition = 0
hi tkochi i add checkbox in ultra grid in this way
'/////////////////////////add checkbox in ultragrid/////////////////////////////////////////////////// Me.UltraGrid1.DisplayLayout.Bands(0).Columns.Add("checkbox", "checkbox") Me.UltraGrid1.DisplayLayout.Bands(0).Columns("checkbox").Header.CheckBoxVisibility = HeaderCheckBoxVisibility.WhenUsingCheckEditor
'Aligns the Header checkbox to the right of the Header caption Me.UltraGrid1.DisplayLayout.Bands(0).Columns("checkbox").Header.CheckBoxAlignment = HeaderCheckBoxAlignment.Right
'The checkbox and the cell values are kept in synch to affect only the RowsCollection Me.UltraGrid1.DisplayLayout.Bands(0).Columns("checkbox").Header.CheckBoxSynchronization = HeaderCheckBoxSynchronization.RowsCollection
Me.UltraGrid1.DisplayLayout.Bands(0).Columns("checkbox").Style = ColumnStyle.CheckBox '///////////////////////////////////////checkbox code is end there////////////////////////// End Sub
if u want more help please check my demo code
http://ahmadkhalid44.blogspot.com/2013/05/work-on-ultra-grid.html
Hello,
I'm populating the Ultragrid from an sql datasource. For the boolean column, its displaying check boxes. I want to display yes/no for these. How do I achieve that?
I tried
foreach(UltraGridRow row in ugrid.Rows)
{
foreach (UltraGridCell cell in row.Cells) { if (cell.Value.GetType().Name.Equals("Boolean")) {if (cell.Value.Equals("true")) { cell.Value = "Yes"; } else { cell.Value = "No"; } } }
}
But since, the datatype is boolean, i'm not able to assign a string value. How do I override the datatype ?
hi, sorry everyone but i'm going to keep this thread going. i have the same problem and nothing is working.
i've defined the schema in the designer. First column being a False just to generate the checkbox view.
Bind at runtime with Linq, when i perform that binding at runtime none of the check boxes are editable..at all.
i verified my AllowUpdate properties, CellClickAction, CellActivation. i added them to my debug watch list right before and after binding to the grid. they looked fine.
i've commented all of my DisplayLayout.override assignments.
One thing i notice, when i go back into the schema designer the first column (my check column) datatype goes back to String. if i try to change the datatype at run time it says i cannot change it because the column is bound.
Could that be the problem?
thank you!
Hi Al,
This doesn't seem like the same issue being reported by others in this thread.
But anyway, if the cells are not editable, then my guess is that your data source doesn't allow editing. As a test, trying binding the DataGridView control to the same data source and see if you can edit in that control. If you can't, then that's a good sign that your data simply doesn't allow it. And if that's the case, nothing you do in the grid will allow you to edit.
If that's not the case, and the DataGridView doe allow editing, then there must be some setting the Wingrid that is preventing it. Perhaps some property on the grid is getting set after you checked it at run-time. Maybe you are loading a layout into the grid and that's turning off editing.
thanks Mike, that was it basically. i was adding the checkbox column to the dataschema, i then found an option to add an unbound column directly in the band/column settings and that did the trick.
thanks
Al
So how might that column be made a REQUIRED entry?
Hi Bill,
There are a number of ways you could acheive that. If the field is required in the data source then the grid will not let the user leave the cell until they fill it in. If you want to handle this on the grid instead of the data source, then you could use an event on the grid such as BeforeExitEditMode, BeforeCellDeactivate, or BeforeCellUpdate to validate the data. Just make sure you use the Text property of the cell in those events, as the Value property reads from the data source and won't reflect changes on the screen that have not yet been saved.
I'm populating the Ultragrid from an sql datasource. For the boolean column, its displaying check boxes. I want to display check for ether unchecked (false )or checked (true) for these. How do I achieve that?