Hi,
Is there any way to do the following in the UltraWebGrid
1. Have a editable column in an datagrid only accept time values like 01:30 (90 minutes) or 00:15 for 15 minutes
2. Have a summary footer that aggregates these value so if you have 2 rows with 01:30 each the total would be 03:00.
The data would need to be saved in some common unit in the database so 01:30 = 90 (minutes) or 1.5 (hours).
Thanks
Thanks Duane, I will give this a try and let you know the result.
/Fredrik
Hello Fredrik,
This is just a follow up on adding a grid column using the format "HH:mm" as a DateTime data type. Enabling the footer can simply be set in the ColFootersVisibleDefault property to true. For handling calculations for total time would be to use the TimeSpan object. This can be calculated using more than one DateTime variables. Finally the column's footer can be set each time a cell is updated.
Let me know if you have any questions with this matter. Thank you.
Sincerely,Duane HoytDeveloper Support Engineer, MCTSInfragisticshttp://es.infragistics.com/support
In the grid when adding a column you can add a DateTime column type and set the Format as "HH:mm". This will allow you to enter and only display the time format of a DateTime variable.
So the markup would look something like this:
<igtbl:UltraGridBand> <Columns> <igtbl:UltraGridColumn BaseColumnName="Time" DataType="System.DateTime" Format="HH:mm" Key="Time"> <Header Caption="Time"> </Header> </igtbl:UltraGridColumn> </Columns> <addnewrow view="NotSet" visible="NotSet"> </addnewrow></igtbl:UltraGridBand>
For adding a footer to the grid would be to set the ColFootersVisibleDefault to "Yes".
Then once a cell has been updated to the grid you can handle the UpdateCell server side event and then use a TimeSpan object to calculate the total amount of hours through all the times that have been entered. Once the TimeSpan object for total hours have been calculated you can display it on the Footer caption that can be set in "e.Cell.Column.Footer.Caption".
Let me know if you have any questions with this matter.