473,387 Members | 1,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Calendar control OnDayRender() method

I have an ASP.Net app that uses the calendar control to select a report
for a particular date. Reports exist for most dates, but not all, so I
would like to highlight the dates for which the reports exist. I asked
about this a while back and was told to use the Calendar.OnDayRender()
method. I am reading about this and getting totally confuesd.

Here is the microsoft documentation http://tinyurl.com/nd4od

I am using ASP.Net 1.1 with VB and using the IDE

First they show this code:

Protected Overridable Sub OnDayRender( _
ByVal cell As TableCell, _
ByVal day As CalendarDay _
)

Is that something I add to my code, or something that is already there?
If I need to add it to my code, where does it go?

Then they show the code below which doesn't look like anything I am
used to seeing in the IDE. I don't understand the html tags around the
VB code. Where does this code go if I am using the IDE?

<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
<head>
<script language="VB" runat="server">
Sub DayRender(source As Object, e As DayRenderEventArgs)
' Change the background color of the days in the month
' to yellow.
If Not e.Day.IsOtherMonth And Not e.Day.IsWeekend Then
e.Cell.BackColor = System.Drawing.Color.Yellow
End If
' Add custom text to cell in the Calendar control.
If e.Day.Date.Day = 18 Then
e.Cell.Controls.Add(New LiteralControl(ChrW(60) & "br"
& ChrW(62) & "Holiday"))
End If
End Sub 'DayRender
</script>
</head>
<body>

<form runat="server">

<h3>DayRender Event Example</h3>

<asp:Calendar id="calendar1"
OnDayRender="DayRender"
runat="server">

<WeekendDayStyle BackColor="gray">
</WeekendDayStyle>

</asp:Calendar>

</form>

</body>
</html>

Aug 1 '06 #1
0 1459

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Greg | last post by:
How do you get rid of the days of the month that are not in the month selected in a calendar control? For example, I have a calendar control that shows November, at the beginning and end of the...
0
by: Guillaume Roy | last post by:
Hi, I am running into a few worrying problems with the ASP.NET calendar control. Styling is the problematic issue. Any info you could provide to help me would be greatly appreciated. The...
2
by: Bruce W..1 | last post by:
I want to change the display style of certain days in my Calendar control. This is done with the DayRender event. So I put this in the codebehind: private void Calendar1_DayRender (object...
2
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
0
by: GFro | last post by:
I have a calendar page that returns a date to a textbox on the parent page. It is returning the wrong format on the deployment server. On the development server the calendar returns to textbox in...
3
by: Peter | last post by:
Does anyone have an example of how you would do a popup window when a user clicks on a day number link in the ASP.NET Web Calendar control? I am trying to create an event calendar similar to how...
4
by: Adam Knight | last post by:
Hi all, I have a page containing a aspx calendar. This page appears in a pop up window via a javascript open window command. What i need to acheive is, once a user has selected a date. This...
6
by: Sridhar | last post by:
Hi, I need to display a calendar that shows all the months of an year. In that, I need to show different colors for certain events. I know how to display a calendar for a certain month but I am...
4
by: rushikesh.joshi | last post by:
Hi All, I want to create custom control by using Web.UI.WebControls.Calendar, in which I want to set few days with different color. I had created two property to set the color and storing in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.