The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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.
ADAdministrator 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.