Solved

How to create a VB.Net Calendar that shows a Information(a pos. or neg. number) along with the day

Posted on 2011-09-27
2
187 Views
Last Modified: 2012-05-12
I have a problem where I have to create a calendar in ASP.net(VB.net) where the day(number) is posted
off to the corner of each block in the calendar, and in the center of each block is a number,
preferrably a font size no smaller than 28(48 or 72 would be fine), that is pulled from an SQL2005 table, the
number will be either positive or negative(-##).  Also if possible, the calendar day should change colors if
the number is negative (Attached is an example of what it looks like in Excel, which we are now using). I need this as soon as possible, so any help would be greatly appreciated. Calendar-ex.doc
0
Comment
Question by:djerome2
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 36717326
You can customize the way that the ASP.NET Calendar renders, by handling the DayRender event, and customizing each cell.

Example:

Cool Tricks With The ASP.net Calendar
http://weblogs.sqlteam.com/jhermiz/archive/2007/12/10/Cool-Tricks-With-The-ASP.net-Calendar.aspx
Protected Sub Calendar13_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar13.DayRender
 	 Dim onmouseoverStyle As String = "this.style.backgroundColor='#D4EDFF'"
	 Dim onmouseoutStyle As String = "this.style.backgroundColor='@BackColor'"
	 Dim rowBackColor As String = String.Empty
            
	 e.Cell.Attributes.Add("onmouseover", onmouseoverStyle)
	 e.Cell.Attributes.Add("onmouseout", onmouseoutStyle.Replace("@BackColor", rowBackColor))
    
     If Not e.Day.IsWeekend Then
                e.Cell.Attributes.Add("onmouseover", onmouseoverStyle)
                e.Cell.Attributes.Add("onmouseout", onmouseoutStyle.Replace("@BackColor", rowBackColor))
     End If
 End Sub

Open in new window

0
 

Author Closing Comment

by:djerome2
ID: 36906593
Solution was not complete, but it did help to point me in the right direction. For that alone, and for being the only one brave enough to even give it a go, I award all points to you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now