Control 1.uccalendar.ascx
<%@ control Language= "VB" autoeventwireup= "false" codebehind= "UCCalendar.aspx.vb" inherits= " Webapplication1.uccalendar "%>
<font face= "new Details" >
<script language= "JavaScript" >
function Checkdate (o) {
var str=new String;
var strend = new String;
STR = O.value;
if (Str!= "")
{
if (Chkformat (Str) = = False)
{
O.focus ();
}
}
}
function Chkformat (DATESTR)
{
var lthdatestr
Lthdatestr= datestr.length;
var tmpy= "";
var tmpm= "";
var tmpd= "";
var datestr;
var status;
status=0;
for (i=0;i<lthdatestr;i++) {
if (Datestr.charat (i) = = '/') {
status++;
}
if (status>2) {
Alert ("date error");
return false;
}
if ((status==0) && (Datestr.charat (i)!= '/')) {
Tmpy=tmpy+datestr.charat (i)
}
if ((status==1) && (Datestr.charat (i)!= '/')) {
Tmpm=tmpm+datestr.charat (i)
}
if ((status==2) && (Datestr.charat (i)!= '/')) {
Tmpd=tmpd+datestr.charat (i)
}
}
Year=new String (tmpy);
Month=new String (TMPM);
Day=new String (TMPD)
tempdate= new String (Year+month+day);
alert (tempdate);
if ((tmpy.length!=4) | | (tmpm.length>2) | | (TMPD.LENGTH>2))
{
Alert ("date error");
Alert ("date");
return false;
}
if (!) ( (1<=month) && (12>=month) && (31>=day) && (1<=day))
{
Alert ("date error");
return false;
}
if (!) ( (year% 4) ==0) && (month==2) && (day==29))
{
Alert ("date error");
return false;
}
if ((month<=7) && ((month% 2) ==0) && (day>=31))
{
Alert ("date error");
return false;
}
if ((month>=8) && ((month% 2) ==1) && (day>=31))
{
Alert ("date error");
return false;
}
if ((month==2) && (day==30)
{
Alert ("date error");
return false;
}
return true;
}
</script>
<div align= "center" ><asp:textbox id= "Txtcalendar" onblur= "checkdate (This)" runat= "Server" width= "181px" ></asp:textbox><asp:button id= "Btncandelar" runat= "server" text= "..." ></asp:button><asp: Calendar id= "CALENDAR1" runat= "Server" width= "208px" height= "200px" borderwidth= "1px" backcolor= "white"
Forecolor= "#003399" font-size= "8pt" font-names= "Verdana" bordercolor= "#3366CC" cellpadding= "1" showgridlines= "True" >
<todaydaystyle forecolor= "White" backcolor= "#99CCCC" ></TodayDayStyle>
<selectorstyle forecolor= "#336666" backcolor= "#99CCCC" ></SelectorStyle>
<nextprevstyle font-size= "8pt" forecolor= "#CCCCFF" ></NextPrevStyle>
<dayheaderstyle height= "1px" forecolor= "#336666" backcolor= "#99CCCC" ></DayHeaderStyle>
<selecteddaystyle font-bold= "True" forecolor= "#CCFF99" backcolor= "#009999" ></SelectedDayStyle>
<titlestyle font-size= "10pt" font-bold= "True" height= "25px" borderwidth= "1px" forecolor= "#CCCCFF"
Borderstyle= "Solid" bordercolor= "#3366CC" backcolor= "#003399" ></TitleStyle>
<weekenddaystyle backcolor= "#CCCCFF" ></WeekendDayStyle>
<othermonthdaystyle forecolor= "#999999" ></OtherMonthDayStyle>
</asp:calendar></div>
</FONT>
2.uccalendar.ascx.vb
Public Class Uccalendar
Inherits System.Web.UI.UserControl
#Region the code generated by the Web Form design tool
' This is the call required by the Web Form design tool.
<system.diagnostics.debuggerstepthrough () > Private Sub InitializeComponent ()
End Sub
Protected WithEvents Calendar1 as System.Web.UI.WebControls.Calendar
Protected WithEvents Txtcalendar as System.Web.UI.WebControls.TextBox