segment of KB summary row code

Referring to the code available at... http://www.syncfusion.com/Support/article.aspx?id=10398 ... there is a segment of the code which sums up the values in a column (sorry if the formatting doesn''t come out nice): for(int row = 1; row <= this.grid.Model.RowCount; ++row) { string s = (row == e.RowIndex) ? e.Style.Text : this.grid.Model[row, e.ColIndex].Text; d += double.Parse((s.Length > 0) ? s : "0"); } My question is: is it necessary to perform the conditional check in the for loop? I''d have thought it would always be sufficient to say: s = this.grid.Model[row, e.ColIndex].Text; and then set d. Please tell me if I am missing something. Thanks in advance.

1 Reply

AD Administrator Syncfusion Team July 1, 2004 03:38 PM UTC

This code is from SaveCellInfo. If the particular (e.RowIndex, e.ColIndex) cell is actively being edited at the point this code is hit, the e.Style.Text would have the new value of the cell, and grid.Model[row, e.ColIndex].Text would have the old (not updated value). This is because the value will not have been moved from the e.Style to the grid until SaveCellInfo has completed.

Loader.
Up arrow icon