I have created a custom control. I am using custom control in a webform on which I have placed a script manager
Below are Javascript code and .ascx file's code
Javascript Code "ION.js"<br />
-------------------------<br />
<br />
var IONDateNow = new Date(Date.parse(new Date().toDateString()));<br />
<br />
<br />
<br />
var IONBaseYear = IONDateNow.getFullYear()-75;<br />
<br />
<br />
var IONDropDownYears = 80;<br />
<br />
<br />
var IONToday = 'Today:',<br />
IONInvalidDateMsg = 'The entered date is invalid.\n',<br />
IONOutOfRangeMsg = 'The entered date is out of range.',<br />
IONDoesNotExistMsg = 'The entered date does not exist.',<br />
IONInvalidAlert = ['Invalid date (',') ignored.'],<br />
IONDateDisablingError = ['Error ',' is not a Date object.'],<br />
IONRangeDisablingError = ['Error ',' should consist of two elements.'],<br />
IONArrMonthNames = ['01','02','03','04','05','06',<br />
'07','08','09','10','11','12'],<br />
IONArrWeekInits = ['S','M','T','W','T','F','S'];<br />
<br />
<br />
<br />
var IONWeekStart = 0;<br />
<br />
<br />
var IONArrDelimiters = ['/','-','.',','];<br />
<br />
<br />
var IONZindex = 1;<br />
<br />
<br />
var IONBlnStrict = false;<br />
<br />
<br />
var IONEnabledDay = [true, true, true, true, true, true, true,<br />
true, true, true, true, true, true, true,<br />
true, true, true, true, true, true, true,<br />
true, true, true, true, true, true, true,<br />
true, true, true, true, true, true, true,<br />
true, true, true, true, true, true, true];<br />
<br />
<br />
var IONDisabledDates = new Array();<br />
<br />
<br />
<br />
var IONActiveToday = true;<br />
<br />
<br />
var IONClickToHide = false;<br />
<br />
<br />
var IONBackground = '#959595';
var IONHeadText = 'White';
<br />
<br />
var IONTodayText = 'White',<br />
IONTodayHighlight = 'Blue';<br />
<br />
var IONHighlightText = 'red',<br />
IONHighlightBackground = 'lavender';<br />
<br />
var IONWeekendText = '#CC6666',<br />
IONWeekendBackground = 'White';<br />
<br />
var IONExMonthText = '#999999',<br />
IONExMonthBackground = '#CCCCCC';<br />
<br />
var IONCellText = 'highlight',<br />
IONCellBackground = 'white';<br />
<br />
var IONInDateText = 'white',<br />
IONInDateBackground = 'Highlight';<br />
<br />
var IONDisabledDayText = '#993333',<br />
IONDisabledDayBackground = '#999999';<br />
<br />
<br />
<br />
document.writeln("<style>");<br />
document.writeln( '.ION {padding:0px;vertical-align:middle;}');<br />
document.writeln( 'iframe.ION {position:absolute;z-index:' + IONZindex +<br />
';top:0px;left:0px;visibility:hidden;' +<br />
'width:1px;height:1px;}');<br />
document.writeln( 'table.ION {padding:0px;visibility:hidden;' +<br />
'position:absolute;width:200px;' +<br />
'top:0px;left:0px;z-index:' + (IONZindex+1) +<br />
';text-align:center;' +<br />
'padding:0px;vertical-align:middle;' +<br />
'background-color:' + IONBackground +<br />
';border:ridge 2px DarkGray;font-size:7pt;' +<br />
'font-family:Verdana,Arial,Helvetica,Sans-Serif;' +<br />
'font-weight:bold;}');<br />
document.writeln( 'td.IONHead {padding:0px 0px;text-align:center;}');<br />
document.writeln( 'select.IONHead {margin:0px 0px;}');<br />
document.writeln( 'input.IONHead {height:21px;width:20px;' +<br />
'vertical-align:middle;' +<br />
'text-align:center;margin:0px 0px;' +<br />
'font-size:7pt;borderwidth:0;font-family:fixedSys;' +<br />
'font-weight:normal;}');<br />
document.writeln( 'tr.IONWeek {text-align:center;font-weight:bold;' +<br />
'color:' + IONHeadText + ';}');<br />
document.writeln( 'td.IONWeek {padding:0px;}');<br />
document.writeln( 'table.IONCells {text-align:right;font-size:7pt;' +<br />
'width:96%;font-family:' +<br />
'Arial,Helvetica,Sans-Serif;}');<br />
document.writeln( 'td.IONCells {padding:0px;vertical-align:middle;' +<br />
'width:16px;height:16px;font-weight:bold;' +<br />
'color:' + IONCellText +<br />
';background-color:' + IONCellBackground +<br />
'}');<br />
document.writeln( 'td.IONFoot {padding:0px;text-align:center;' +<br />
'font-weight:normal;color:' +<br />
IONTodayText + ';}');<br />
document.writeln("</style>");<br />
<br />
<br />
function IONInputFormat(IONArrInput,IONEleValue)<br />
{var IONArrSeed = new Array();<br />
<br />
IONBlnFullInputDate = false;<br />
<br />
switch (IONArrInput.length)<br />
{case 1:<br />
{
IONArrSeed[0] = parseInt(IONArrInput[0],10);
IONArrSeed[1] = '6';
IONArrSeed[2] = 1;
break;<br />
}<br />
case 2:<br />
{
IONArrSeed[0] = parseInt(IONArrInput[1],10);
IONArrSeed[1] = IONArrInput[0];
IONArrSeed[2] = 1;
break;<br />
}<br />
case 3:<br />
{
IONArrSeed[0] = parseInt(IONArrInput[2],10);
IONArrSeed[1] = IONArrInput[1];
IONArrSeed[2] = parseInt(IONArrInput[0],10);
<br />
<br />
IONBlnFullInputDate = true;<br />
break;<br />
}<br />
default:<br />
{
IONArrSeed[0] = 0;
IONArrSeed[1] = 0;
IONArrSeed[2] = 0;
}<br />
}<br />
<br />
<br />
if (IONExpValYear.exec(IONArrSeed[0]) == null ||<br />
IONExpValMonth.exec(IONArrSeed[1]) == null ||<br />
IONExpValDay.exec(IONArrSeed[2]) == null)<br />
{
IONBlnFullInputDate = false;<br />
IONArrSeed[0] = IONBaseYear + Math.floor(IONDropDownYears/2);
IONArrSeed[1] = '6';
IONArrSeed[2] = 1;
}<br />
<br />
<br />
return IONArrSeed;<br />
}<br />
<br />
function IONDisplayFormat(IONDisplayDate)<br />
{
<br />
document.write(IONArrMonthNames[IONDisplayDate.getMonth()] + "/" +<br />
IONDisplayDate.getDate() + "/" +<br />
IONDisplayDate.getFullYear());<br />
}<br />
<br />
function IONSetOutput(IONOutputDate)<br />
{
IONTargetEle.value = ((IONOutputDate.getDate()<10)?'0':'') +<br />
IONOutputDate.getDate() + '-' +<br />
((IONOutputDate.getMonth()<9)?'0':'') +<br />
(IONOutputDate.getMonth()+1) + '-' +<br />
IONOutputDate.getFullYear();<br />
<br />
<br />
<br />
IONHide();<br />
}<br />
<br />
<br />
<br />
var IONIsOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);<br />
<br />
<br />
var IONIsFirefox= (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);<br />
<br />
var IONTargetEle,<br />
IONSaveText,<br />
IONSaveBackground,<br />
IONMonthSum = 0,<br />
IONBlnFullInputDate = false,<br />
IONStartDate = new Date(),<br />
IONSeedDate = new Date(),<br />
IONWeekStart = IONWeekStart%7;<br />
<br />
<br />
var IONExpDelimiters = new RegExp('[\\'+IONArrDelimiters.join('\\')+']','g');<br />
<br />
<br />
<br />
var IONExpValDay = /^(0?[1-9]|[1-2]\d|3[0-1])$/,<br />
IONExpValMonth = new RegExp("^(0?[1-9]|1[0-2]|" +<br />
IONArrMonthNames.join("|") +<br />
")$","i"),<br />
IONExpValYear = /^(\d{2}|\d{4})$/;<br />
<br />
function IONshowCal(IONEle,IONSourceEle) {IONShow(IONEle,IONSourceEle);}<br />
function IONShow(IONEle,IONSourceEle)<br />
{
<br />
IONSeedDate = IONDateNow;<br />
<br />
IONEle.value = IONEle.value.replace(/^\s+/,'').replace(/\s+$/,'');<br />
<br />
if (IONEle.value.length==0)<br />
{
<br />
IONBlnFullInputDate=false;<br />
<br />
if ((new Date(IONBaseYear+IONDropDownYears-1,11,31))<IONSeedDate ||<br />
(new Date(IONBaseYear,0,1)) >IONSeedDate<br />
)<br />
{IONSeedDate = new Date(IONBaseYear +<br />
Math.floor(IONDropDownYears / 2), 5, 1);<br />
}<br />
}<br />
else<br />
{
IONArrSeedDate =<br />
IONInputFormat(IONEle.value.split(IONExpDelimiters),<br />
IONEle.value);<br />
<br />
<br />
<br />
if (IONArrSeedDate[0]<100)<br />
{IONArrSeedDate[0]= IONArrSeedDate[0] +<br />
parseInt((IONArrSeedDate[0]>50)?1900:2000,<br />
10);<br />
}<br />
<br />
<br />
if (IONArrSeedDate[1].search(/\d+/)!=0)<br />
{month = IONArrMonthNames.join('|').toUpperCase().<br />
search(IONArrSeedDate[1].substr(0,3).toUpperCase());<br />
IONArrSeedDate[1] = Math.floor(month/4)+1;<br />
}<br />
<br />
IONSeedDate = new Date(IONArrSeedDate[0],<br />
IONArrSeedDate[1]-1,<br />
IONArrSeedDate[2]);<br />
}<br />
<br />
<br />
if (isNaN(IONSeedDate))<br />
{
IONSeedDate = new Date(IONBaseYear +<br />
Math.floor(IONDropDownYears/2),5,1);<br />
IONBlnFullInputDate=false;<br />
}<br />
else<br />
{
<br />
if ((new Date(IONBaseYear,0,1)) > IONSeedDate)<br />
{if (IONBlnStrict)
IONSeedDate = new Date(IONBaseYear,0,1);<br />
IONBlnFullInputDate=false;<br />
}<br />
else<br />
{if ((new Date(IONBaseYear+IONDropDownYears-1,11,31))<<br />
IONSeedDate)<br />
{if (IONBlnStrict)
IONSeedDate = new Date(IONBaseYear +<br />
Math.floor(IONDropDownYears)-1,<br />
11,1);<br />
IONBlnFullInputDate=false;<br />
}<br />
else<br />
{if (IONBlnStrict && IONBlnFullInputDate &&<br />
(IONSeedDate.getDate() != IONArrSeedDate[2] ||<br />
(IONSeedDate.getMonth()+1) != IONArrSeedDate[1] ||<br />
IONSeedDate.getFullYear() != IONArrSeedDate[0]<br />
)<br />
)<br />
{
IONSeedDate = new Date(IONSeedDate.getFullYear(),<br />
IONSeedDate.getMonth()-1,1);<br />
IONBlnFullInputDate=false;<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
for (var i=0;i<IONDisabledDates.length;i++)<br />
{if (!((typeof IONDisabledDates[i] == 'object') &&<br />
(IONDisabledDates[i].constructor == Date)))<br />
{if ((typeof IONDisabledDates[i] == 'object') &&<br />
(IONDisabledDates[i].constructor == Array))<br />
{var IONPass = true;<br />
<br />
if (IONDisabledDates[i].length !=2)<br />
{
IONPass = false;<br />
}<br />
else<br />
{for (var j=0;j<IONDisabledDates[i].length;j++)<br />
{if (!((typeof IONDisabledDates[i][j] == 'object') &&<br />
(IONDisabledDates[i][j].constructor == Date)))<br />
{
IONPass = false;<br />
}<br />
}<br />
}<br />
<br />
if (IONPass && (IONDisabledDates[i][0] > IONDisabledDates[i][1]))<br />
{IONDisabledDates[i].reverse();}<br />
}<br />
else<br />
{
}<br />
}<br />
}<br />
<br />
<br />
IONMonthSum = 12*(IONSeedDate.getFullYear()-IONBaseYear)+<br />
IONSeedDate.getMonth();<br />
<br />
<br />
<br />
<br />
<br />
document.getElementById('IONYears').options.selectedIndex =75<br />
<br />
var IONShowDate = new Date(Date.parse(new Date().toDateString()));<br />
<br />
document.getElementById('IONMonths').options.selectedIndex=IONShowDate.getMonth(); <br />
<br />
<br />
var offsetTop =parseInt(IONEle.offsetTop,10)+<br />
parseInt(IONEle.offsetHeight,10),<br />
offsetLeft=parseInt(IONEle.offsetLeft,10);<br />
<br />
IONTargetEle=IONEle;<br />
<br />
do {IONEle=IONEle.parentNode;<br />
if (IONEle.tagName!='FORM' &&<br />
IONEle.tagName!='TBODY' &&<br />
IONEle.tagName!='TR' &&<br />
((IONIsFirefox && IONEle.tagName!='DIV') || !IONIsFirefox) &&<br />
IONEle.nodeType==1)<br />
{offsetTop +=parseInt(IONEle.offsetTop,10);<br />
offsetLeft+=parseInt(IONEle.offsetLeft,10);<br />
<br />
if(IONEle.tagName=='DIV')<br />
{<br />
offsetTop-=IONEle.scrollTop;<br />
}<br />
<br />
}<br />
}<br />
while (IONEle.tagName!='BODY');<br />
<br />
document.getElementById('ION').style.top =offsetTop +'px';<br />
document.getElementById('ION').style.left=offsetLeft+'px';<br />
<br />
if (!IONIsOpera)<br />
{document.getElementById('IONIframe').style.top =offsetTop +'px';<br />
document.getElementById('IONIframe').style.left=offsetLeft+'px';<br />
document.getElementById('IONIframe').style.width =<br />
(document.getElementById('ION').offsetWidth-2)+'px';<br />
document.getElementById('IONIframe').style.height =<br />
(document.getElementById('ION').offsetHeight-2)+'px';<br />
document.getElementById('IONIframe').style.visibility='visible';<br />
}<br />
<br />
<br />
IONShowMonth(0);<br />
<br />
<br />
document.getElementById('ION').style.visibility='visible';<br />
<br />
IONCancelPropagation(IONSourceEle);<br />
}<br />
<br />
function IONCellOutput(IONEvt)<br />
{var IONEle = IONeventTrigger(IONEvt),<br />
IONOutputDate = new Date(IONStartDate);<br />
<br />
IONOutputDate.setDate(IONStartDate.getDate() +<br />
parseInt(IONEle.id.substr(8),10));<br />
<br />
IONSetOutput(IONOutputDate);<br />
}<br />
<br />
function IONFootOutput()<br />
{IONSetOutput(IONDateNow);}<br />
<br />
function IONCancelPropagation(IONSourceEle)<br />
{if (typeof event=='undefined')
{IONSourceEle.parentNode.<br />
addEventListener("click",IONStopPropagation,false);<br />
}<br />
else {event.cancelBubble = true;}
}<br />
<br />
function IONStopPropagation(IONEvt)<br />
{if (typeof event=='undefined')<br />
IONEvt.stopPropagation();
else IONEvt.cancelBubble = true;
}<br />
<br />
function IONHighlight(e)<br />
{var IONEle = IONeventTrigger(e);<br />
<br />
IONSaveText =IONEle.style.color;<br />
IONSaveBackground =IONEle.style.backgroundColor;<br />
<br />
IONEle.style.color =IONHighlightText;<br />
IONEle.style.backgroundColor =IONHighlightBackground;<br />
<br />
return true;<br />
}<br />
<br />
function IONUnhighlight(e)<br />
{var IONEle = IONeventTrigger(e);<br />
<br />
IONEle.style.backgroundColor =IONSaveBackground;<br />
IONEle.style.color =IONSaveText;<br />
<br />
return true;<br />
}<br />
<br />
function IONeventTrigger(e)<br />
{if (!e) e = event;<br />
return e.target||e.srcElement;<br />
}<br />
<br />
function IONCancel(e)<br />
{if (IONClickToHide) IONHide();<br />
IONStopPropagation(e);}<br />
<br />
function IONHide()<br />
{document.getElementById('ION').style.visibility='hidden';<br />
if (!IONIsOpera)<br />
{document.getElementById('IONIframe').style.visibility='hidden';}<br />
}<br />
<br />
function IONFootOver()<br />
{document.getElementById('IONFoot').style.color=IONTodayHighlight;<br />
document.getElementById('IONFoot').style.fontWeight='bold';<br />
}<br />
<br />
function IONFootOut()<br />
{document.getElementById('IONFoot').style.color=IONTodayText;<br />
document.getElementById('IONFoot').style.fontWeight='normal';<br />
}<br />
<br />
function IONShowMonth(IONBias)<br />
{
<br />
var IONShowDate = new Date(Date.parse(new Date().toDateString()));<br />
<br />
IONSelYears = document.getElementById('IONYears');<br />
IONSelMonths = document.getElementById('IONMonths');<br />
<br />
if (IONSelYears.options.selectedIndex>-1)<br />
{IONMonthSum=12*(IONSelYears.options.selectedIndex)+IONBias;<br />
if (IONSelMonths.options.selectedIndex>-1)<br />
{IONMonthSum+=IONSelMonths.options.selectedIndex;}<br />
}<br />
else<br />
{if (IONSelMonths.options.selectedIndex>-1)<br />
{IONMonthSum+=IONSelMonths.options.selectedIndex;}<br />
}<br />
<br />
IONShowDate.setFullYear(IONBaseYear + Math.floor(IONMonthSum/12),<br />
(IONMonthSum%12),<br />
1);<br />
<br />
if ((12*parseInt((IONShowDate.getFullYear()-IONBaseYear),10)) +<br />
parseInt(IONShowDate.getMonth(),10) < (12*IONDropDownYears) &&<br />
(12*parseInt((IONShowDate.getFullYear()-IONBaseYear),10)) +<br />
parseInt(IONShowDate.getMonth(),10) > -1)<br />
{IONSelYears.options.selectedIndex=Math.floor(IONMonthSum/12);<br />
IONSelMonths.options.selectedIndex=(IONMonthSum%12);<br />
<br />
IONCurMonth = IONShowDate.getMonth();<br />
<br />
IONShowDate.setDate(-(IONShowDate.getDay()-IONWeekStart)%7+1);<br />
<br />
IONStartDate = new Date(IONShowDate);<br />
<br />
var IONFoot = document.getElementById('IONFoot');<br />
<br />
if (IONDisabledDates.length==0)<br />
{if (IONActiveToday)<br />
{IONFoot.onclick=IONFootOutput;<br />
IONFoot.onmouseover=IONFootOver;<br />
IONFoot.onmouseout =IONFootOut;<br />
}<br />
else<br />
{if (document.addEventListener)<br />
{IONFoot.addEventListener('click',IONStopPropagation, false);}<br />
else {IONFoot.attachEvent('onclick',IONStopPropagation);}<br />
IONFoot.onmouseover=null;<br />
IONFoot.onmouseout=null;<br />
}<br />
}<br />
else<br />
{for (var k=0;k<IONDisabledDates.length;k++)<br />
{if (!IONActiveToday ||<br />
((typeof IONDisabledDates[k] == 'object') &&<br />
(((IONDisabledDates[k].constructor == Date) &&<br />
IONDateNow.valueOf() == IONDisabledDates[k].valueOf()<br />
) ||<br />
((IONDisabledDates[k].constructor == Array) &&<br />
IONDateNow.valueOf() >= IONDisabledDates[k][0].valueOf() &&<br />
IONDateNow.valueOf() <= IONDisabledDates[k][1].valueOf()<br />
)<br />
)<br />
)<br />
)<br />
{if (document.addEventListener)<br />
{IONFoot.addEventListener('click',IONStopPropagation, false);}<br />
else {IONFoot.attachEvent('onclick',IONStopPropagation);}<br />
IONFoot.onmouseover=null;<br />
IONFoot.onmouseout=null;<br />
break;<br />
}<br />
else<br />
{IONFoot.onclick=IONFootOutput;<br />
IONFoot.onmouseover=IONFootOver;<br />
IONFoot.onmouseout =IONFootOut;<br />
}<br />
}<br />
}<br />
<br />
<br />
var IONCells = document.getElementById('IONCells');<br />
<br />
for (i=0;i<IONCells.childNodes.length;i++)<br />
{var IONRows = IONCells.childNodes[i];<br />
if (IONRows.nodeType==1 && IONRows.tagName=='TR')<br />
{for (j=0;j<IONRows.childNodes.length;j++)<br />
{var IONCols = IONRows.childNodes[j];<br />
if (IONCols.nodeType==1 && IONCols.tagName=='TD')<br />
{IONRows.childNodes[j].innerHTML=<br />
IONShowDate.getDate();<br />
<br />
var IONCellStyle=IONRows.childNodes[j].style,<br />
IONDisabled = false;<br />
<br />
for (var k=0;k<IONDisabledDates.length;k++)<br />
{if ((typeof IONDisabledDates[k] == 'object') &&<br />
(IONDisabledDates[k].constructor == Date) &&<br />
IONShowDate.valueOf() == IONDisabledDates[k].valueOf())<br />
{IONDisabled = true;}<br />
else<br />
{if ((typeof IONDisabledDates[k] == 'object') &&<br />
(IONDisabledDates[k].constructor == Array) &&<br />
IONShowDate.valueOf() >= IONDisabledDates[k][0].valueOf() &&<br />
IONShowDate.valueOf() <= IONDisabledDates[k][1].valueOf())<br />
{IONDisabled = true;}<br />
}<br />
}<br />
<br />
if (IONDisabled || !IONEnabledDay[j+(7*((i*IONCells.childNodes.length)/6))])<br />
{IONRows.childNodes[j].onclick=null;<br />
IONRows.childNodes[j].onmouseover=null;<br />
IONRows.childNodes[j].onmouseout=null;<br />
IONCellStyle.color=IONDisabledDayText;<br />
IONCellStyle.backgroundColor=<br />
IONDisabledDayBackground;<br />
}<br />
else<br />
{IONRows.childNodes[j].onclick =IONCellOutput;<br />
IONRows.childNodes[j].onmouseover =IONHighlight;<br />
IONRows.childNodes[j].onmouseout =IONUnhighlight;<br />
<br />
if (IONShowDate.getMonth()!=IONCurMonth)<br />
{IONCellStyle.color=IONExMonthText;<br />
IONCellStyle.backgroundColor=<br />
IONExMonthBackground;<br />
}<br />
else if (IONBlnFullInputDate &&<br />
IONShowDate.toDateString()==<br />
IONSeedDate.toDateString())<br />
{IONCellStyle.color=IONInDateText;<br />
IONCellStyle.backgroundColor=<br />
IONInDateBackground;<br />
}<br />
else if (IONShowDate.getDay()%6==0)<br />
{IONCellStyle.color=IONWeekendText;<br />
IONCellStyle.backgroundColor=<br />
IONWeekendBackground;<br />
}<br />
else<br />
{IONCellStyle.color=IONCellText;<br />
IONCellStyle.backgroundColor=<br />
IONCellBackground;<br />
}<br />
}<br />
<br />
IONShowDate.setDate(IONShowDate.getDate()+1);<br />
}<br />
}<br />
}<br />
}<br />
}<br />
}<br />
<br />
if (!IONIsOpera)<br />
{document.write("<iframe class='ION' " +<br />
"id='IONIframe' name='IONIframe' " +<br />
"frameborder='0'>" +<br />
"</iframe>");<br />
}<br />
<br />
<br />
document.write(<br />
"<table id='ION' class='ION'>" +<br />
"<tr class='ION'>" +<br />
"<td class='ION'>" +<br />
"<table class='IONHead' id='IONHead' " +<br />
"cellspacing='0' cellpadding='0' width='100%'>" +<br />
"<tr class='IONHead'>" +<br />
"<td class='IONHead'>" +<br />
"<input class='IONHead' type='button' value='<' " +<br />
"onclick='IONShowMonth(-1);' /></td>" +<br />
"<td class='IONHead'>" +<br />
"<select id='IONMonths' class='IONHead' " +<br />
"onChange='IONShowMonth(0);'>");<br />
<br />
for (i=0;i<IONArrMonthNames.length;i++)<br />
document.write( "<option>" + IONArrMonthNames[i] + "</option>");<br />
<br />
document.write(" </select>" +<br />
"</td>" +<br />
"<td class='IONHead'>" +<br />
"<select id='IONYears' class='IONHead' " +<br />
"onChange='IONShowMonth(0);'>");<br />
<br />
for (i=0;i<IONDropDownYears;i++)<br />
document.write( "<option>" + (IONBaseYear+i) + "</option>");<br />
<br />
document.write( "</select>" +<br />
"</td>" +<br />
"<td class='IONHead'>" +<br />
"<input class='IONHead' type='button' value='>' " +<br />
"onclick='IONShowMonth(1);' /></td>" +<br />
"</tr>" +<br />
"</table>" +<br />
"</td>" +<br />
"</tr>" +<br />
"<tr class='ION'>" +<br />
"<td class='ION'>" +<br />
"<table class='IONCells' align='center'>" +<br />
"<thead class='IONWeek'>" +<br />
"<tr class='IONWeek'>");<br />
<br />
for (i=0;i<IONArrWeekInits.length;i++)<br />
document.write( "<td class='IONWeek'>" +<br />
IONArrWeekInits[(i+IONWeekStart)%IONArrWeekInits.length] +<br />
"</td>");<br />
<br />
document.write("</tr>" +<br />
"</thead>" +<br />
"<tbody class='IONCells' id='IONCells'>");<br />
<br />
for (i=0;i<6;i++)<br />
{document.write(<br />
"<tr class='IONCells'>");<br />
for (j=0;j<7;j++)<br />
{document.write(<br />
"<td class='IONCells' id='IONCell_" + (j+(i*7)) +<br />
"'></td>");<br />
}<br />
<br />
document.write(<br />
"</tr>");<br />
}<br />
<br />
document.write(<br />
"</tbody>");<br />
<br />
if ((new Date(IONBaseYear + IONDropDownYears, 11, 32)) > IONDateNow &&<br />
(new Date(IONBaseYear, 0, 0)) < IONDateNow)<br />
{document.write(<br />
"<tfoot class='IONFoot'>" +<br />
"<tr class='IONFoot'>" +<br />
"<td class='IONFoot' id='IONFoot' colspan='7'>" + IONToday + " ");<br />
<br />
IONDisplayFormat(IONDateNow);<br />
<br />
document.write(<br />
"</td>" +<br />
"</tr>" +<br />
"</tfoot>");<br />
}<br />
<br />
document.write(<br />
"</table>" +<br />
"</td>" +<br />
"</tr>" +<br />
"</table>");<br />
<br />
if (document.addEventListener)<br />
{document.addEventListener('click',IONHide, false);<br />
document.getElementById('ION').addEventListener('click',IONCancel,false);<br />
document.getElementById('IONHead').addEventListener('click',IONStopPropagation,false);<br />
document.getElementById('IONCells').addEventListener('click',IONStopPropagation,false);<br />
}<br />
else<br />
{document.attachEvent('onclick',IONHide);<br />
document.getElementById('ION').attachEvent('onclick',IONCancel);<br />
document.getElementById('IONHead').attachEvent('onclick',IONStopPropagation);<br />
document.getElementById('IONCells').attachEvent('onclick',IONStopPropagation);<br />
}<br />
<br />
<br />
<br />
<br />
<br />
function IONIONnumericRequired(sender,arguments)<br />
{<br />
var checkOK = "0123456789."; <br />
var checkStr =arguments.Value; <br />
var i,j;<br />
var flag = true; <br />
var cntChk=checkStr.length;<br />
var cntOK=checkOK.length;<br />
<br />
<br />
for (i = 0; i < cntChk; i++)<br />
{<br />
ch = checkStr.charAt(i);<br />
for (j = 0; j < cntOK ; j++)<br />
{<br />
if (ch == checkOK.charAt(j)) <br />
break;<br />
if (j ==cntOK -1)<br />
{<br />
flag = false;<br />
break; <br />
} <br />
}<br />
<br />
if(flag==true)<br />
{<br />
arguments.IsValid=true;<br />
}<br />
else<br />
{<br />
arguments.IsValid=false;<br />
}<br />
}<br />
}<br />
<br />
<br />
function IONnumericReq(obj)<br />
{<br />
<br />
var checkOK = "0123456789"; <br />
var flag = true;<br />
<br />
for (i = 0; i < obj.value.length; i++)<br />
{<br />
ch = obj.value.charAt(i);<br />
for (j = 0; j < checkOK.length; j++)<br />
{<br />
if (ch == checkOK.charAt(j)) <br />
break;<br />
if (j == checkOK.length-1)<br />
{<br />
flag = false;<br />
break; <br />
} <br />
}<br />
}<br />
<br />
if(flag==true)<br />
alert("data is numeric");<br />
else<br />
{<br />
alert("enter nuneric data");<br />
}<br />
} <br />
<br />
function IONshowDate(id)<br />
{<br />
IONShow(id,this);<br />
}<br />
<br />
code in ".ascx file"
---------------------
<br />
<br />
artial Class Controls_calendar_DateSelector<br />
Inherits System.Web.UI.UserControl<br />
<br />
<br />
<br />
#Region " Web Form Designer Generated Code "<br />
<br />
'This call is required by the Web Form Designer.<br />
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()<br />
<br />
End Sub<br />
'Protected WithEvents lbl_Date As System.Web.UI.WebControls.Label<br />
'Protected WithEvents txt_Date As System.Web.UI.WebControls.TextBox<br />
'Protected WithEvents imgCalendar As System.Web.UI.WebControls.Image<br />
'Protected WithEvents PnlCalender As System.Web.UI.WebControls.Panel<br />
<br />
'NOTE: The following placeholder declaration is required by the Web Form Designer.<br />
'Do not delete or move it.<br />
Private designerPlaceholderDeclaration As System.Object<br />
<br />
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init<br />
'CODEGEN: This method call is required by the Web Form Designer<br />
'Do not modify it using the code editor.<br />
InitializeComponent()<br />
End Sub<br />
<br />
#End Region<br />
<br />
Private intLeftPos As Integer<br />
Private intTopPos As Integer<br />
Private UntWidth As System.Web.UI.WebControls.Unit<br />
<br />
<br />
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
'Put user code to initialize the page here<br />
Dim strUserpos As String<br />
strUserpos = intLeftPos.ToString & " , " & intTopPos.ToString<br />
<br />
Dim scriptStr As String = _<br />
"javascript:return IONshowDate(" & getClientID() & ")"<br />
<br />
imgCalendar.Attributes.Add("onclick", scriptStr)<br />
<br />
End Sub<br />
<br />
' Get the id of the control rendered on client side<br />
' Very essential for Javascript Calendar scripts to locate the textbox<br />
Public Function getClientID() As String<br />
Return txt_Date.ClientID()<br />
End Function<br />
'This property will set the CSS for textbox if it is in Fast Entry<br />
Public WriteOnly Property FastEntry() As Boolean<br />
Set(ByVal Value As Boolean)<br />
If Value = True Then<br />
txt_Date.CssClass = "txtNoFocusFE"<br />
Else<br />
txt_Date.CssClass = "txtNoFocus"<br />
End If<br />
End Set<br />
End Property<br />
<br />
<br />
' This propery sets/gets the calendar date<br />
Public Property CalendarDate() As String<br />
Get<br />
Return txt_Date.Text<br />
End Get<br />
Set(ByVal Value As String)<br />
txt_Date.Text = Value<br />
End Set<br />
End Property<br />
<br />
Public Property readOnlyDate() As Boolean<br />
Get<br />
Return imgCalendar.Visible<br />
End Get<br />
Set(ByVal Value As Boolean)<br />
imgCalendar.Visible = Value<br />
End Set<br />
End Property<br />
<br />
Public Property Editable() As Boolean<br />
Get<br />
Return txt_Date.ReadOnly<br />
End Get<br />
Set(ByVal Value As Boolean)<br />
txt_Date.ReadOnly = Not Value<br />
End Set<br />
End Property<br />
<br />
Public Property Width() As System.Web.UI.WebControls.Unit<br />
Get<br />
Return UntWidth<br />
End Get<br />
Set(ByVal Value As System.Web.UI.WebControls.Unit)<br />
Dim Unttmp As New Unit<br />
Dim UntTmpWidth As New Unit<br />
Dim cnvtUnt As New UnitConverter<br />
'UntTmpWidth = Value<br />
UntWidth = Value<br />
UntTmpWidth = Value<br />
<br />
Select Case Value.Type 'Value.Type<br />
Case UnitType.Pixel<br />
'If Value.Value < 86 Then<br />
' UntTmpWidth = Unit.Point(86)<br />
'End If<br />
Unttmp = Unit.Pixel(UntTmpWidth.Value - imgCalendar.Width.Value)<br />
Case UnitType.Percentage<br />
Unttmp = Unit.Percentage(Value.Value - 15)<br />
Case UnitType.Point<br />
'If Value.Value < 65 Then<br />
' UntTmpWidth = Unit.Point(65)<br />
'End If<br />
imgCalendar.Width = Unit.Point((imgCalendar.Width.Value * 0.75))<br />
UntTmpWidth = Unit.Pixel(Value.Value * 1.33)<br />
Unttmp = Unit.Pixel(UntTmpWidth.Value - imgCalendar.Width.Value)<br />
End Select<br />
PnlCalender.Width = UntTmpWidth<br />
txt_Date.Width = Unttmp<br />
End Set<br />
End Property<br />
<br />
Public Property LeftPos() As Integer<br />
Get<br />
Return intLeftPos<br />
End Get<br />
Set(ByVal Value As Integer)<br />
intLeftPos = Value<br />
End Set<br />
End Property<br />
Public Property TopPos() As Integer<br />
Get<br />
Return intTopPos<br />
End Get<br />
Set(ByVal Value As Integer)<br />
intTopPos = Value<br />
End Set<br />
End Property<br />
<br />
End Class<br />
<br />
Ranvijay Sahay
|