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

bold headers and cell format problem

Hi Clay, Could you please advise on two simple things, that do not work for me. 1. Cannot set all grid headers in bold. The code doesn''t affect the headers. I set font size which is OK, but cannot set bold by gridDataBoundGrid1.BaseStylesMap["Header"].StyleInfo.Font.Bold = true; 2.After using code you kindly provided in the posting for summary grid to compute the sum of all columns and rows in CalculateValues() method of GridSummaryRow class, then I try to set format for that cell which shows the sum: this.summaryGrid[1, i + 1].Format = "#0.0"; also tried: this.summaryGrid[1, i + 1].Format =this.grid.Model[1, i + 1].Format; also tried using summaryGrid.Model.... No effect. The value like 23.5 is shown correctly but value with no decimal point is shown as 23 instead of 23.0 Thanks

7 Replies

AD Administrator Syncfusion Team August 11, 2004 10:48 AM

1) Try setting the basetyle on the "Column Header" instead of "Header". this.gridDataBoundGrid1.BaseStylesMap["Column Header"].StyleInfo.Font.Bold = true; 2) If the CellType of these summary cells is not "FormulaCell", then to get the Format to work, you need to set the style.CellValueType = typeof(double).


IR Irina August 13, 2004 07:24 AM

Hi, Clay, Thanks for help. The headers are Ok, Format is correct for all columns except the only one. That column is formula cell on main grid. I set it gdbg.Binder.InternalColumns["gortotal"].StyleInfo.Format = "#0.0"; It is shown correctly on main grid. On summary grid after calculation I set it like you advised: this.summaryGrid[1, i + 1].CellValue = sum; this.summaryGrid[1, i + 1].Format = "#0.0"; this.summaryGrid[1, i + 1].CellValueType = typeof(double); It is shown correctly if sum has decimal point, if not - it is shown like 23 instead of 23.0 Thanks


AD Administrator Syncfusion Team August 13, 2004 08:10 AM

Is this.summaryGrid[1, i + 1].CellType = "FormulaCell"? If sum has already been calculated, then it should not be. It should be CellType = "TextBox" (or maybe "Static"). If it is "FormulaCell", then setting CellValueType = typeof(double) will cause problems which maybe why the formatting is not working properly.


IR Irina August 13, 2004 10:55 AM

It is not "Formula Cell" and sum is already calculated. Actually I did not set CellType. But now I tried both TextBox and Static. The value shown is still the same.


AD Administrator Syncfusion Team August 13, 2004 11:52 AM

Is sum a double? Try using this.summaryGrid[1, i + 1].CellValue = (double) sum; Immediately after setting the format, if you try string s = this.summaryGrid[1, i + 1].FormattedText; What is s?


IR Irina August 13, 2004 12:45 PM

s is 23.0 sum is double and the value of sum is also 23.0, but then it is shown as 23 in the summary grid cell.


AD Administrator Syncfusion Team August 13, 2004 01:05 PM

this.summaryGrid[1, i + 1].FormattedText; should be what will be displayed in the grid cell, so I am not sure why 23.0 is not being shown in the cell. If you can post a sample project showing the problem, we can try to debug it here.

Loader.
Live Chat Icon For mobile
Up arrow icon