473,598 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_contra ct_date" runat="server" backcolor="#fff fff"
width="250px" height="200px" font-size="12px" font-names="Arial"
borderwidth="2p x" bordercolor="#0 00000" nextprevformat= "shortmonth "
daynameformat=" firsttwoletters " OnSelectionChan ged="cldr_Selec tionChanged">
<titlestyle font-size="14px" font-bold="true" borderwidth="2p x"
forecolor="#000 055" />
<dayheadersty le font-size="12px" font-bold="true" />
<todaydaystyl e backcolor="#D3D 3D3" forecolor="#fff fff" />
<selecteddaysty le backcolor="#000 000" forecolor="#fff fff" />
<nextprevstyl e font-size="12px" font-bold="true" forecolor="#333 333" />
<othermonthdays tyle forecolor="#ccc ccc" />
</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 4124
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**@discussio ns.microsoft.co mwrote in message
news:7E******** *************** ***********@mic rosoft.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_contra ct_date" runat="server" backcolor="#fff fff"
width="250px" height="200px" font-size="12px" font-names="Arial"
borderwidth="2p x" bordercolor="#0 00000" nextprevformat= "shortmonth "
daynameformat=" firsttwoletters "
OnSelectionChan ged="cldr_Selec tionChanged">
<titlestyle font-size="14px" font-bold="true" borderwidth="2p x"
forecolor="#000 055" />
<dayheadersty le font-size="12px" font-bold="true" />
<todaydaystyl e backcolor="#D3D 3D3" forecolor="#fff fff" />
<selecteddaysty le backcolor="#000 000" forecolor="#fff fff" />
<nextprevstyl e font-size="12px" font-bold="true" forecolor="#333 333" />
<othermonthdays tyle forecolor="#ccc ccc" />
</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:DropDownLi st ID="drpMonthCal " runat="server"
AutoPostBack="T rue"
OnSelectedIndex Changed="drpCal Month_SelectedI ndexChanged"
Width="101px" />
</td>
<td align="left">
<asp:DropDownLi st ID="drpYearCal " runat="server"
AutoPostBack="T rue"
OnSelectedIndex Changed="drpCal Year_SelectedIn dexChanged"
Width="104px" />
</td>
</tr>
<tr valign="top">
<td colspan="2" align="center">
<asp:Calendar ID="calSource" runat="server"
BackColor="#FFF FCC"
BorderColor="#F FCC66" BorderWidth="1p x"
DayNameFormat=" Shortest"
Font-Names="Verdana" Font-Size="8pt"
ForeColor="#663 399" Height="200px"
ShowGridLines=" True" Width="220px"
OnSelectionChan ged="calSource_ SelectionChange d">
<SelectedDaySty le BackColor="#FFC C66" />
<TodayDayStyl e ForeColor="#CC9 966" />
<SelectorStyl e BackColor="#FFC C66" />
<OtherMonthDayS tyle ForeColor="#CC9 966" />
<NextPrevStyl e Font-Size="9pt" ForeColor="#FFF FCC"
/>
<DayHeaderSty le BackColor="#FFC C66"
Font-Bold="True" Height="1px" />
<TitleStyle BackColor="#990 000" Font-Bold="True"
Font-Size="9pt" ForeColor="#FFF FCC" />
</asp:Calendar>
</td>
</tr>
</table>

[b:c30d324379].cs file[/b:c30d324379]
<%@ Page Language="C#" MasterPageFile= "~/Pop/PopMasterPage.m aster"
AutoEventWireup ="true" CodeFile="Calen dar.aspx.cs"
Inherits="Pop_C alendar" Title="Mission Beach Volleyball - Calendar"
%>
<asp:Content ID="Content1"
ContentPlaceHol derID="PopConte ntPlaceHolder" 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:DropDownLi st ID="drpMonthCal " runat="server"
AutoPostBack="T rue"
OnSelectedIndex Changed="drpCal Month_SelectedI ndexChanged"
Width="101px" />
</td>
<td align="left">
<asp:DropDownLi st ID="drpYearCal " runat="server"
AutoPostBack="T rue"
OnSelectedIndex Changed="drpCal Year_SelectedIn dexChanged"
Width="104px" />
</td>
</tr>
<tr valign="top">
<td colspan="2" align="center">
<asp:Calendar ID="calSource" runat="server"
BackColor="#FFF FCC"
BorderColor="#F FCC66" BorderWidth="1p x"
DayNameFormat=" Shortest"
Font-Names="Verdana" Font-Size="8pt"
ForeColor="#663 399" Height="200px"
ShowGridLines=" True" Width="220px"
OnSelectionChan ged="calSource_ SelectionChange d">
<SelectedDaySty le BackColor="#FFC C66" />
<TodayDayStyl e ForeColor="#CC9 966" />
<SelectorStyl e BackColor="#FFC C66" />
<OtherMonthDayS tyle ForeColor="#CC9 966" />
<NextPrevStyl e Font-Size="9pt" ForeColor="#FFF FCC"
/>
<DayHeaderSty le BackColor="#FFC C66"
Font-Bold="True" Height="1px" />
<TitleStyle BackColor="#990 000" Font-Bold="True"
Font-Size="9pt" ForeColor="#FFF FCC" />
</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
3658
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 controls. Private Sub DateSold_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) SoldCal.Visible = True
5
4594
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 Color 3. Foreground Color 4. Border Tickness 5. Border Color
1
2149
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. During the "Edit" command of the grid, I have the following code: <code> If e.CommandName = "Edit" Then Dim myDatagridItem As DataGridItem Dim lblStartDate As Label Dim lblEndDate As Label
0
1734
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 controls (i.e. roundedcorners component www.4guysfromrolla.com], buttons and panels) functions like a tab control. The buttons are programmatically designed to make the corresponding panel visible. Sample aspx.vb code:
2
3406
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 controls (i.e. roundedcorners component www.4guysfromrolla.com], buttons and panels) functions like a tab control. The buttons are programmatically designed to make the corresponding panel visible. Sample aspx.vb code:
3
850
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
2629
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" runat="server" EnablePartialRendering="true"/> <atlas:UpdatePanel runat="server" ID="UpdatePanel1" Mode="Conditional"> <ContentTemplate> After inserting this code, my calendar stopped working in that if I clicked on a date, nothing would...
7
2363
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 version of the application. The javascript version worked nicely -- you click on a calendar.gif in an anchor next to a textbox. The calender would pop up in a new window, you select the date, the calendar window would close and the textbox would be...
6
1955
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 combo box on the form and have bound the control to the Date Reported field. I have placed the calendar control on the form and set the Visible property to no. The following code has bee added to the Mouse Down Event of the Date
3
2719
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 assist with this. Thanks in advance. 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.
0
8284
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8046
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8262
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6711
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3894
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2410
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1500
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.