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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

801 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