Advertisement

07.24.2008 at 08:53AM PDT, ID: 23592565
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Problem with Events Calendar - ASP Classic

Asked by sk1922 in Active Server Pages (ASP), Cascading Style Sheets (CSS), Hypertext Markup Language (HTML)

Tags: ,

I'm trying to modify a events calendar I found online. The calendar works fine, but I want to modify the code to highlight the day that has events versus showing the actual event title/description. Essentially, I would like all <TD> cells that have events to show in say green and make that particular date click-able and all <TD> cells that have no events just display in plain text. I tried to modify the code but when I did it worked for the current month, then next month was completely blank - no dates were showing up. I've attached the original code I found. Any suggestions and/or guidance would be greatly appreciated.

Thanks. Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
Set objRecordset = Server.CreateObject("ADODB.Recordset")
objRecordset.Open "EventsTbl", strConn, adOpenStatic, adLockPessimistic, adCmdTable
 
Dim dDate     ' Date we're displaying calendar for
Dim iDIM      ' Days In Month
Dim iDOW      ' Day Of Week that month starts on
Dim iCurrent  ' Variable we use to hold current day of month as we write table
Dim iPosition ' Variable we use to hold current position in table
 
If IsDate(Request.QueryString("date")) Then
	dDate = CDate(Request.QueryString("date"))
Else
	If IsDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Then
		dDate = CDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year"))
	Else
		dDate = Date()
 
		If Request.QueryString.Count <> 0 Then
			Response.Write "The date you picked was not a valid date.  The calendar was set to today's date.<BR><BR>"
		End If
	End If
End If
 
iDIM = GetDaysInMonth(Month(dDate), Year(dDate))
iDOW = GetWeekdayMonthStartsOn(Month(dDate), Year(dDate))
 
Response.Write "<div id='EventsCalContainer'>"
Response.Write "<table id='Events' width='285px' height='230px' cellspacing='2' cellpadding='0'>"
Response.Write "<tr>"
Response.Write "<td bgcolor='#f1f1f1' align='center' colspan='7'>"
Response.Write "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
Response.Write "<tr>"
Response.Write "<td align='right'><b><A HREF='index.asp?date=" & SubtractOneMonth(dDate) & "' style='color: #FFFFFF'>&lt;--</A></b></TD>"
Response.Write "<td id='CalCurrDate'>" & MonthName(Month(dDate)) & " " & Year(dDate) & "</td>"
Response.Write "<td align='left'><b><A HREF='index.asp?date=" & AddOneMonth(dDate) & "' style='color: #FFFFFF'>--&gt;</A></b></TD>"
Response.Write "<td align='right' valign='top'>&nbsp;</td>"
Response.Write "</tr>"
Response.Write "</TABLE>"
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td class='CalDayofMonth'>Sun</td>"
Response.Write "<td class='CalDayofMonth'>Mon</td>"
Response.Write "<td class='CalDayofMonth'>Tue</td>"
Response.Write "<td class='CalDayofMonth'>Wed</td>"
Response.Write "<td class='CalDayofMonth'>Thu</td>"
Response.Write "<td class='CalDayofMonth'>Fri</td>"
Response.Write "<td class='CalDayofMonth'>Sat</td>"
Response.Write "</tr>"
 
If iDOW <> 1 Then
	Response.Write(vbTab & "<tr>" & vbCrLf)
	iPosition = 1
	Do While iPosition < iDOW
		Response.Write(vbTab & vbTab & "<td>&nbsp;</td>" & vbCrLf)
		iPosition = iPosition + 1
	Loop
End If
 
	'-- Write days of month in proper day slots --
 
iCurrent = 1
iPosition = iDOW
 
Do While iCurrent <= iDIM
 
	'-- open the table row --
 
	If iPosition = 1 Then
		Response.Write(vbTab & "<tr>" & vbCrLf)
	End If
	
	Response.Write(vbTab & vbTab & "<td align=left valign=top height=30>" & iCurrent)
  
	If Not objRecordset.BOF Then
	objRecordset.MoveFirst
	Do Until objRecordset.EOF
	If objRecordset.Fields("Year") = Year(dDate) Then
	    If objRecordset.Fields("Month") = Month(dDate) Then
	    
	        If objRecordset.Fields("Day") = iCurrent Then
		      Response.Write("<div class='ActiveEvent'><b><a href=" & Chr(34) & "display_event.asp?ID=" & objRecordset.Fields("ID") & Chr(34) & ">" & objRecordset.Fields("Title") & "</a></b></div>")
          'Else
          'Response.Write(iCurrent)
          End If
 
	    End If
	End If
	objRecordset.MoveNext
	Loop
	Else
	End If
	
	'-- Close the table row --
 
	If iPosition = 7 Then
		Response.Write vbTab & "</tr>" & vbCrLf
		iPosition = 0
	End If
 
	'-- Increment variables --
 
	iCurrent = iCurrent + 1
	iPosition = iPosition + 1
Loop
 
If iPosition <> 1 Then
	Do While iPosition <= 7
		Response.Write(vbTab & vbTab & "<td>&nbsp;</td>" & vbCrLf)
		iPosition = iPosition + 1
	Loop
	Response.Write vbTab & "</tr>" & vbCrLf
End If
Response.Write "</table>"
Response.Write "</div>"
[+][-]07.24.2008 at 04:40PM PDT, ID: 22084753

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 04:42PM PDT, ID: 22084762

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 08:25AM PDT, ID: 22089394

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.28.2008 at 10:39AM PDT, ID: 22105159

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.31.2008 at 11:58PM PDT, ID: 22136037

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 09:15AM PDT, ID: 22139682

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Active Server Pages (ASP), Cascading Style Sheets (CSS), Hypertext Markup Language (HTML)
Tags: ASP Classic, N/A
Sign Up Now!
Solution Provided By: peh803
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.05.2008 at 06:13AM PDT, ID: 22160520

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.05.2008 at 08:27AM PDT, ID: 22161869

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628