Hi,
I am adding a CheckBox column to my wingrid at runtime. How can I make it default to 'false' as opposed to the filled in square of 'null'? Right now I am looping through each cell and setting it to False. This is also marking the row as "edited". Does anyone know a better way? Here is my code so far:
Infragistics.Win.UltraWinGrid.UltraGridColumn completedColumn;
completedColumn.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox;
{
}
Looping through the rows is certainly not the best way to do it.
The best way is probably to do it on the data source. What kind of data source are you using? Most data sources, like a DataTable or UltraDataSource let you specify a default value for a column.
Another way to do it would be to use the InitializeRow event of the grid, rather than looping.
Hi Mike,
I have checkbox in a ultragrid and i want to first check by default when grid is loaded how can i do that please suggest me.
Hi Ganesh,
The simplest way would be to bind the grid to a data source where all the values for that column are true.
If it's an unbound column, then you can use the DefaultCellValue property on the column and set that to true.
Or you could use the InitializeRow event to set the value of the checkbox cell to true when e.ReInitialize is false.
Do you mean activate a row or select it? It doesn't make any sense to select a row and not have any visual indication that the row is selected. But if you are talking about the active row, then this article will tell you how to turn off the highlight.
Hi Mike
when i have select any row in ultragrid then i dont want to selected row backgroung color blue what can i do for that.
Mike Its Working
Thanks a lot
My guess is that you checked the checkbox using the mouse and then you clicked on a toolbar button or some other object that doesn't take focus from the grid. The last cell you changed is therefore still in edit mode and the change has not yet been committed, so the Value property of the cell has not yet been updated with the new value.
The easiest solution to that is to call grid.UpdateData to commit all changes to the grid before you start your loop.
Hi Mike, I have facing one problem i Have a ultragrid with checkbox Problem is that when i have check 4 checkbox at coding level it show only 3 is checked 4th checkbox value return false i am not able get all checked box value. My code is that
1)i have check 4 checkbox.Its return only 3 is true and 4th checkbox is false
int i = 0; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in billingPolicyGroupUltraGrid.Rows) {
foreach (Infragistics.Win.UltraWinGrid.UltraGridCell cell in row.Cells) {
if (cell.Column.Key == "SelectToProcess") { if ((bool)cell.Value) {//if checked return truei++;
can you provide any other solution to get all checked checkbox value