Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2007, 11:29 AM
Authorized User
 
Join Date: Sep 2007
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using the Calendar tool

I've started following the Beginning ASP.Net 2.0 book and my interest took a leap when the Calendar tool was used early on to demonstrate how easily complex items could be added to the web page. I want to use the Calendar on a Walks web site to highlight days on which particular events start. Usually there is one event per month. I've created a simple Access database with date, location and descriptions fields, and want to use the date field to highlight that date in the Calendar. Next, I would like the user to be able to click on the date and either go to the relevant page for that event, or display the location and description fields on the Calendar page.
My reading has taken me to the end of Ch 4 of the book so perhaps this task is a bit beyond me and may be dealt with later in the book. Can you point me in the right direction, or suggest what else I may need to do?

Thanks.

Richard
Rugeley, UK
WinXP Pro SP2
VBW Express
__________________
Richard
Rugeley, UK
WinXP Pro SP2
VBW Express + SQL Server 2005 Express
 
Old October 25th, 2007, 11:55 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This is fairly simple and I do something similar in one of my current applications.

Goto www.summitmetroparks.org and on the index of the site you will see a calendar with various days highlighted in an off orange color that represent dates that events are occuring (dates with no events are simply white). Is this the type of functionality you are trying to recreate?

To achieve this, I handle 2 events that the calendar control exposes: DayRender and SelectionChanged.

DayRender occurs every time a day is rendered to the calendar (this event will fire at LEAST 28 times)

SelectionChanged occurs when you click on a specific date.

My psuedo-code logic is something like this:
DayRender
If current Day is not part of the other month then
     Return data from a database if the current day has an associated event.
     If there is associated data change the BackColor of the cell to reflect this.
end if

SelectionChanged
Response.Redirect to a page that accepts a date as a query string parameter to display the current event.

Note that a calendar can render dates from a precceding and succeding month so that is why i check to see if the date is part of a different month in my DayRender event.

hth.


================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========
 
Old October 26th, 2007, 08:47 AM
Authorized User
 
Join Date: Sep 2007
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks dp. The calendar date appearance change is the kind of thing I wanted to achieve. When the user clicks on the date, a selection of images will be loaded together with the description field. The image URLs will go into the database.

Alternatively, as I only have monthly activities to display, would it be possible to automatically retrieve the fields from the database record for the activity date when the page has loaded without requiring the user to click? e.g.
    If current date is within one week before the next activity date, display the upcoming activity details, otherwise display the previous activity details.

I don't want to try running before I can walk, though! :)

Richard
Rugeley, UK
WinXP Pro SP2
VBW Express
 
Old October 27th, 2007, 10:39 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

 If current date is within one week before the next activity date, display the upcoming activity details, otherwise display the previous activity details.

I am not sure what you mean by that? Do you mean to say that you want to adjust the calendar's cell property to display the details of the event but only if current date is within the date of the activity?

That can be done yes. Simply use the DayRender event of the calendar to maniuplate the data and you can do whatever you like to a given cell.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Any new V.B. tool? anamika VB.NET 0 October 10th, 2008 07:28 AM
Calendar like calendar in AJAX in ASP.NET h@ckerz ASP.NET 2.0 Professional 0 February 19th, 2008 12:56 AM
Tool Tip MunishBhatia ASP.NET 2.0 Professional 2 May 11th, 2007 05:39 PM
Tool Tips in C# DAK BOOK: Professional C#, 2nd and 3rd Editions 0 January 8th, 2004 12:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.