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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

762 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