|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Calendar Control and ASP.Net 2.0Here 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 Here's a code sample that shows how to change the year easily with the
calendar (from ASPNet101.com): http://aspnet101.com/aspnet101/aspnet/codesample.aspx?code=changeyear "Paul" <P***@discussions.microsoft.com> wrote in message OnSelectionChanged="cldr_SelectionChanged">news:7E7FF792-04E5-4158-9399-B0DAB54E12AD@microsoft.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" Show quoteHide quote > <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 > 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_SelectedIndexChanged"
Width="101px" />
</td>
<td align="left">
<asp:DropDownList ID="drpYearCal" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="drpCalYear_SelectedIndexChanged"
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_SelectedIndexChanged"
Width="101px" />
</td>
<td align="left">
<asp:DropDownList ID="drpYearCal" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="drpCalYear_SelectedIndexChanged"
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
Other interesting topics
Hi XML problem,:toggle display effect
Misterious IP -> name resolution in Uri.GetLeftPart() method VS2005 Enable ASP.NET Debugging in Class Library App Breadcrumb Navigation bar MessageBox Strange problem how can i change a value in an <object> </object> VB Script Function ASP.NET 2.0 static variables in Global.asax http vs https |
|||||||||||||||||||||||