|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Coloring Calendar !!!I am struggling with somenthing that might be a little too advanced (for me). Thanks for any help in advance. I have a database table that contains reservations for apartments, the table structure is as follow: IDReservation, IDApartment, dteArrival, dteDeparture etc. What I would like to do is having the asp net calandar control render those dates that are included in the table as taken coloring the differently. I understand that I should use the onDayRender event but I have no idea how to the code should go...!!! Right now I don't think to add any further functionality to my calendar I only need to display the color for example red for dates that are taken! I don't have much so far in mind... I can retrieve a dataset for my Reservation table and then have a subroutine looking into the rows to see what dates are taken but how to? Ciao Lorenzo You should retreive data for the selected month only.
Then your code could look like: protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { // weekends closed if (e.Day.IsWeekend) e.Day.IsSelectable = false; // show status as specific color for (int x = 0; x < _MyData.GetLength(0); x++) { if (_MyData[x].Date == e.Day.Date ) { e.Cell.ForeColor = System.Drawing.Color.LightSalmon; } } } Of course you should walk through the dataRows of your datatable rather than an array. Hope this helps. JosZ -- JosephZet ------------------------------------------------------------------------ JosephZet's Profile: http://www.hightechtalks.com/m258 View this thread: http://www.hightechtalks.com/t2280318
Finding a way to bind ASP.NET controls(two way) to a typed-dataset
Error in DataList test query - aspnet 2.0 getting Membership userid to use and store in a custom database Gridview Updates not writing to database after clicking update Datagrid paging I lose my sort Dynamically Adding DataLists FormView DataBinding in Insert mode Hyperlink Control Status text Custom DropDownList Control and ListItem |
|||||||||||||||||||||||