Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timesheet page

Status
Not open for further replies.

Sammy145

Programmer
Oct 4, 2002
173
GB
I have a gridview as

project | User | Mon | Tues | Wed | Thur |Fri | Sat | Sun | Edit


Now the data is in this format
project: HOur: Day:
1 5 03/12/2007
1 2 04/12/2007
1 0 05/12/2007


Now how can i get the data out to bind to the grid so the days are across.

 
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.


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
I'd ditch the GridView and go with a Repeater.

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.

The footer template would just close the table.

MCP, MCTS - .NET Framework 2.0 Web Applications
 
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.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top