Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Checkbox default value
posted

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 = myGrid.DisplayLayout.Bands[0].Columns.Insert(0, "Completed");

 

completedColumn.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox;

foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in myGrid.Rows)

{

row.Cells[
"Completed"].Value = false;

}

 

Parents
  • 469350
    Verified Answer
    Offline posted

     Hi,

        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.

Reply Children