Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Calendar Control Question

Posted on 2005-03-17
Medium Priority
Last Modified: 2012-06-27
I have two questions with the asp:calendar control.

First off I am adding events to days so some week's height tend to be larger then others, is there a property to set so that all cells are the same height and width after putting all of my events in the days cells.

Secondly is there a way to only show the days of the current month???  It seems to want to fill every box so it includes dates from the previous and next month when I only want dates for this month.

thanks in advance
Question by:macros14
  • 2
LVL 12

Accepted Solution

laotzi2000 earned 2000 total points
ID: 13571506
You should override the PreRender event of the calendar control


 Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
        If (e.Day.IsOtherMonth) Then
            e.Cell.Text = ""
            e.Cell.Height = New System.Web.UI.WebControls.Unit(20)
        End If

    End Sub

Author Comment

ID: 13571884
This works for the days but it doesn't work for the height.

What happens is one week there is no events and the next week there are some events, so the week before's height is the height is smaller then the height of the week's with events.
LVL 12

Expert Comment

ID: 13574571
I'm showing you how to change the height of a specific day.
You should write your own function to decide if a specific day has event.
If it has, you can change its height of the cell or change the font of the text
according to your needs.

Good luck.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

578 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