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
188 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
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…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

777 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