473,395 Members | 2,006 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,395 software developers and data experts.

Calendar Control and ASP.Net 2.0

I am using the standard Calendar control in ASP.Net 2.0 and VB.Net and VS2005.

Here is the code:

<asp:calendar id="cldr_contract_date" runat="server" backcolor="#ffffff"
width="250px" height="200px" font-size="12px" font-names="Arial"
borderwidth="2px" bordercolor="#000000" nextprevformat="shortmonth"
daynameformat="firsttwoletters" OnSelectionChanged="cldr_SelectionChanged">
<titlestyle font-size="14px" font-bold="true" borderwidth="2px"
forecolor="#000055" />
<dayheaderstyle font-size="12px" font-bold="true" />
<todaydaystyle backcolor="#D3D3D3" forecolor="#ffffff" />
<selecteddaystyle backcolor="#000000" forecolor="#ffffff" />
<nextprevstyle font-size="12px" font-bold="true" forecolor="#333333" />
<othermonthdaystyle forecolor="#cccccc" />
</asp:calendar>

My question revolves around the ability of the user to select a month or
year that is a long length of time from the default date.

For example, the default date that is displayed on the calendar is today.
The user wants to select a day that is 3 years prior to today.

Right now, it appears that the only way that the user can select that
3-years-prior date is to continually click the previous month link until he
gets to 3 years ago. That is 36 clicks and it is no surprise that the user is
not happy having to do that.

Is there a way to configure the Calendar control to where the user can
select the year (and even month) without so many clicks?

If the answer is no, could anyone recommend another flexible third-party
calendar control that integrates well with VS2005 and VB.Net?

TIA

Sep 8 '06 #1
2 4114
Here's a code sample that shows how to change the year easily with the
calendar (from ASPNet101.com):
http://aspnet101.com/aspnet101/aspne...ode=changeyear

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"Paul" <Pa**@discussions.microsoft.comwrote in message
news:7E**********************************@microsof t.com...
I am using the standard Calendar control in ASP.Net 2.0 and VB.Net and
VS2005.
>
Here is the code:

<asp:calendar id="cldr_contract_date" runat="server" backcolor="#ffffff"
width="250px" height="200px" font-size="12px" font-names="Arial"
borderwidth="2px" bordercolor="#000000" nextprevformat="shortmonth"
daynameformat="firsttwoletters"
OnSelectionChanged="cldr_SelectionChanged">
<titlestyle font-size="14px" font-bold="true" borderwidth="2px"
forecolor="#000055" />
<dayheaderstyle font-size="12px" font-bold="true" />
<todaydaystyle backcolor="#D3D3D3" forecolor="#ffffff" />
<selecteddaystyle backcolor="#000000" forecolor="#ffffff" />
<nextprevstyle font-size="12px" font-bold="true" forecolor="#333333" />
<othermonthdaystyle forecolor="#cccccc" />
</asp:calendar>

My question revolves around the ability of the user to select a month or
year that is a long length of time from the default date.

For example, the default date that is displayed on the calendar is today.
The user wants to select a day that is 3 years prior to today.

Right now, it appears that the only way that the user can select that
3-years-prior date is to continually click the previous month link until
he
gets to 3 years ago. That is 36 clicks and it is no surprise that the user
is
not happy having to do that.

Is there a way to configure the Calendar control to where the user can
select the year (and even month) without so many clicks?

If the answer is no, could anyone recommend another flexible third-party
calendar control that integrates well with VS2005 and VB.Net?

TIA

Sep 8 '06 #2
I started with the example url from the first reply, and it did some
things great, but the calendar included days from the previous and
next months and the drop down lists did not seem to update correctly
when those days were selected. I am a newbie to .Net, but here is
what I came up with:

aspx file
<table cellpadding="2" cellspacing="0" border="0"
align="center">
<tr valign="top">
<td colspan="2" align="left">
<asp:Label ID="lblDate" runat="server" Text="" />
</td>
</tr>
<tr valign="top">
<td align="left">
<asp:DropDownList ID="drpMonthCal" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="drpCalMonth_SelectedIndexC hanged"
Width="101px" />
</td>
<td align="left">
<asp:DropDownList ID="drpYearCal" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="drpCalYear_SelectedIndexCh anged"
Width="104px" />
</td>
</tr>
<tr valign="top">
<td colspan="2" align="center">
<asp:Calendar ID="calSource" runat="server"
BackColor="#FFFFCC"
BorderColor="#FFCC66" BorderWidth="1px"
DayNameFormat="Shortest"
Font-Names="Verdana" Font-Size="8pt"
ForeColor="#663399" Height="200px"
ShowGridLines="True" Width="220px"
OnSelectionChanged="calSource_SelectionChanged">
<SelectedDayStyle BackColor="#FFCC66" />
<TodayDayStyle ForeColor="#CC9966" />
<SelectorStyle BackColor="#FFCC66" />
<OtherMonthDayStyle ForeColor="#CC9966" />
<NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC"
/>
<DayHeaderStyle BackColor="#FFCC66"
Font-Bold="True" Height="1px" />
<TitleStyle BackColor="#990000" Font-Bold="True"
Font-Size="9pt" ForeColor="#FFFFCC" />
</asp:Calendar>
</td>
</tr>
</table>

[b:c30d324379].cs file[/b:c30d324379]
<%@ Page Language="C#" MasterPageFile="~/Pop/PopMasterPage.master"
AutoEventWireup="true" CodeFile="Calendar.aspx.cs"
Inherits="Pop_Calendar" Title="Mission Beach Volleyball - Calendar"
%>
<asp:Content ID="Content1"
ContentPlaceHolderID="PopContentPlaceHolder" Runat="Server">
<table cellpadding="2" cellspacing="0" border="0"
align="center">
<tr valign="top">
<td colspan="2" align="left">
<asp:Label ID="lblDate" runat="server" Text="" />
</td>
</tr>
<tr valign="top">
<td align="left">
<asp:DropDownList ID="drpMonthCal" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="drpCalMonth_SelectedIndexC hanged"
Width="101px" />
</td>
<td align="left">
<asp:DropDownList ID="drpYearCal" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="drpCalYear_SelectedIndexCh anged"
Width="104px" />
</td>
</tr>
<tr valign="top">
<td colspan="2" align="center">
<asp:Calendar ID="calSource" runat="server"
BackColor="#FFFFCC"
BorderColor="#FFCC66" BorderWidth="1px"
DayNameFormat="Shortest"
Font-Names="Verdana" Font-Size="8pt"
ForeColor="#663399" Height="200px"
ShowGridLines="True" Width="220px"
OnSelectionChanged="calSource_SelectionChanged">
<SelectedDayStyle BackColor="#FFCC66" />
<TodayDayStyle ForeColor="#CC9966" />
<SelectorStyle BackColor="#FFCC66" />
<OtherMonthDayStyle ForeColor="#CC9966" />
<NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC"
/>
<DayHeaderStyle BackColor="#FFCC66"
Font-Bold="True" Height="1px" />
<TitleStyle BackColor="#990000" Font-Bold="True"
Font-Size="9pt" ForeColor="#FFFFCC" />
</asp:Calendar>
</td>
</tr>
</table>
</asp:Content>

I hope it helps.

----------------------------------
http://community.ihostasp.net
ASP.NET Developer Community
Sep 11 '06 #3

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

Similar topics

0
by: Tim Graichen | last post by:
Hello, I am making use of the Active X calendar control (mscal.Calendar.7) in several places in my main form, with the following code Below is an example of the code I'm using for the...
5
by: Miguel Dias Moura | last post by:
Hello, i am trying to create a .css file with several styles and apply them to the calendar control so i can change the look of: 1. Text Type and Format (Bold, Underline, etc) 2. Background...
1
by: bill yeager | last post by:
I would like to place the currently selected date (retrieved from the database) on a calendar control which is embedded inside a datagrid. However, I can't find the ID of the control to do so....
0
by: maxrawson | 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...
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...
3
by: Peter | last post by:
Is there anyway to make the System.Web.UI.WebControls.Calendar to display only Month Name and Year, like: January, 2006 February, 2006 ..... .... .... ....
3
by: =?Utf-8?B?UGFycm90?= | last post by:
I applied the following Ajax code in my web page which has a calendar control to keep my page from completely reloading everytime something was changed. <atlas:ScriptManager ID="ScriptManager1"...
7
by: John Kotuby | last post by:
Hi all, I am trying to use a calendar server control which I have ID="Calendar1" in the source code. What I am trying to do is emulate a JavaScript calendar that was being used in an older ASP...
6
by: thorpk | last post by:
I have an access database that i have added a pop up calendar to, the Table information for the Date Reported field is Date/Time format short date, input mask is 00/00/0000. i have created a...
3
by: thorpk | last post by:
I posted this problem earlier in the month and some one decided it was better to change the subject and ask a completely different question. I am therefore reposting. I am hoping some one can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.