We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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 11:38 AM

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.
Live Chat Icon For mobile
Up arrow icon