You may be better off doing this directly in your sql statement. Have a look at the sql CASE statement, and ask in the SQL Server forum if you get any problems implementing it.
You can set the header template to display Mon-Sun, etc. in HTML table header form, and the ItemTemplate can be crafted to use one cell per data item, which is a week's worth of data sorted by date.
I'm relatively new to ASP.NET, so my answer is my not be the best you will get, but I did write a timesheet application.
I dynamically built a datatable that had a structure that matched how I wanted to present it on the grid (e.g. it had a "Day" column with "Monday", "Tuesday", etc.).
I retrieved my data with a DataReader, and looped through the rows, adding each to my "virtual" table, doing whatever translations needed to be done along the way (i.e. from the WorkDay field, which was a date, figure out the day of the week, e.g. Dec. 17, 2007 --> "Monday").
I then passed this DataTable to the grid.
Saving the data was basically a reverse of this process, i.e. "Monday" --> Dec. 17, 2007.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.