Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Calender / Availability project

Author  Topic 

Mondeo
Constraint Violating Yak Guru

287 Posts

Posted - 2007-11-05 : 07:30:32
I've got a project to do which I know should be simple, but i've been struggling to work out the best way to do it.

The way the web designers done it is a html table accross the page with the rows being months Jan 08 - Dec 08 and the columns being the days 1-31. The idea is that if I date is available the background colour of that cell would be green, and red if its taken.

The database containing the bookings simple has three columns

id(int)
datefrom(datetime)
dateto(dateto)

This is an example table cell

<td height="20" style="background-color: #999999"><div align="center">1 </div></td>

So whats the best way to accomplish this,

So far I've decided to read the entire database table into a local DataTable object, then loop through this datatable and change the background color of the cells like this.

<td height="20" style="<%=MAY(1)%"><div align="center">1 </div></td>
<td height="20" style="<%=MAY(2)%"><div align="center">2 </div></td>

i.e. using an array for each month.

Is this the best way, or can anyone suggest an alternative

Thanks
   

- Advertisement -