Hello guys!
I am using the UltraWebGrid to display a table by setting a DataTable as DataSource dynamically at code behind.
The table contains one number column with currency amounts inside, which i am summing up during runtime, At the DataTable I add an additional row which displays the sum of all entries of the number column.
If I sort the column now, of course the sum row is also affected. But i want to have the sum row always on bottom.
Does anyone know how i can get this. An example code would help.
---------------------------
I still have another problem. The amounts in number row are of type XX.XX EUR (e.g. 180,93 EUR).
Because of the currency I had to define the Type of this column as System.String. When I am sorting this column now, it's sorted as String, which ends in wrong order result.
Is there any way to cast the entries of the column to numbers in code behind. I have also heard the option to add an aditional column of type System.Decimal and hidding it. When i click on sort on the column with the trailing EUR, I will sort the table by the hidden column.
But I have no idea how to do this.
Can anyone help?
Hello AniLex!
Thank you for your great tipp. I got it worked.
For the sumrow I used the footerrow of Ultrawebgrid.
For the sorting issue, i did a workaround. The Header contains the currency instead of putting the currency into the cells now.
for the sum row, you can use footer to show the summary. Then you will not have the sorting issue.
For currency you can use a hidden column that has only currency value e.g. 180,93. And when user click on currency column then sort the grid based on the value in the hidden column.
-Ani