|
Did anyone find a solution to this problem? I am using .Net 2.0 control and all I want to do is to get the value out of the textbox but I am getting "Unable to cast object of type System.Web.UI.LiteralControl to type System.Web.UI.WebControls.TextBox" when running this code:
Dim startTime As String
startTime = DatePickerStartTime.Text
If anyone has a solution to this can you please email me at mphalen@stlawu.edu
Thanks
|
|
|
|
|
Hi,
I have been looking into this error. In my case (and possibly everyone elses), the reason for the invalid cast is that in the Property 'Gets and Sets' (for the control) refer to the control as controls(0). This is normally ok, but because i am using a formview with a TemplateColumn (<InsertItemTemplate>) the actual posistion within the controls() array is 1 and not 0. So, each of the references to the control in the gets and sets should be "Controls(1)" (but only when using TemplateColumns in ASP.NET 2.0 - which is likely to be the case a lot of the time when using databinding with controls like Formview and Gridview)
Unfortunately this is not the full solution to the problem. After finding and changing it, i found that the error message no longer occured, and the bind is succesful, however...the text value of the DatePicker control is always an empty string for some reason. Hence it inserts an empty string into the datasource as the date. NOT IDEAL! Its almost like the control is never actually setting the text value when the calendar is clicked, even though it appears to do so on screen. But i'm not sure how or why yet.
Anyway, i'll continue looking at it tomorrow if i get a chance, but i just thought i would let you people know what i had found as you might be able to get the last bit yourself. If so, please do let me know.
Cheers
Rob
|
|
|
|
|
I had success by changing the lines with
Control(0)
to
Control(Me.Controls.Count - 1) .
I have only tested this with master and content pages.
--
Kenneth Chr. Nilsen
Optisoft
|
|
|
|
|
Where did you change this?
I can't get it to work.
|
|
|
|
|
I am getting the following error. PLEASE HELP..I am a newbie...will appreciate any ideas. I am using visual studio.net 2003.
The type or namespace name 'iX' does not exist in the class or namespace 'DatePicker.iX.Controls.DatePicker' (are you missing an assembly reference?)
If anyone has the updated code to this thing without the bugs, please email it to me at iamdogmatic@yahoo.com, i would really appreciate it.
Gagan Chhatwal
-- modified at 15:02 Friday 7th April, 2006
|
|
|
|
|
Have you managed to solve this problem ,I am getting the same error
|
|
|
|
|
Hello Doug,
Thanks for the Control .It is very useful, but i am having trouble in reading the value selected in the Grid. Iam getting a InvalidCast Exception.I need to know how to bind previous data into the textbox and also read the sselected date .
Ima getting the value of the Datepicker as:
GridViewRow row = GridView1.Rows[e.rowIndex];
string value1 = ((DatePicker)row.FindControl("DatePicker1")).Text;
Iam getting Exception as Can not Cast of type UI.Literal Control to TextBox.
Please let me know how to use this .Idid find some posts with same errors but could not find the right answer.
Thanks for your time .
|
|
|
|
|
HEY I AM GETTING THE SAME PROB WHILE READING VALUE FROM GRIDVIEW , IN MY GRID VIEW THERE R TEXTBOXES SO I NEED TO READ THE ENTERED VALUES IN TEXT BOXES TO AN ARRAY, ANY WAY I GOT SOLUTION FOR UR PROBLEM
while type casting use this tecqunic.
suppose there u given
TextBox t=(TextBox) gv.rows[0].cells[0].controls[0];
may be it will give error because controls[0] is a litaral then comes ur TextBox ie
TextBox t=(TextBox) gv.rows[0].cells[0].controls[1];
controles[1] is a textbox ...
try it i solved my convertion prob in this way my be it will work for u
Hi friends have a good day
|
|
|
|
|
Hi!
I am suffering the well-known z-index problem in IE. Whenever the popup calendar is placed in the same coordinates as a dropdown list, the dropdown appears over the calendar.
Any way to solve this with the control?
Any fix to the javascript code?
Thanks in advance.
|
|
|
|
|
That one prob stinks .. cant get around it .. I tried Divs around the box etc.. and around controls.. the only way to lose it for real is to hide the div that te combo is in and then let your popup do its magic.. I know crazy crazy..
|
|
|
|
|
Doug,
I see from previous posts that you were working on coding a new version of this. I like the look and feel of the date picker, but have been having some problems getting the text value to pass to my update parameter properly (asp.net 2.0). Before I started debugging this version, have you coded a new version? If so, can you post it? Otherwise, any suggestions?
I have this line in the EditItemTemplate:
<<cc1:datepicker id="ContractDatePicker" runat="server" imgdirectory="images/DatePicker/" datetype="mm/dd/yyyy"
text="<%# Bind("ContractDate","{0 }") %>" ><="" cc1:datepicker>
<="" code="">
I have an updatecommand =
UPDATE [MainTable] Set [ContractDate]=@ContractDate,...
And the appropriate
<UpdateParameters/>
...
<asp:Parameter Type="DateTime" Name="ContractDate" />
...
</UpdateParameters>
Many Thanks,
Robert
-- modified at 16:08 Friday 17th March, 2006
|
|
|
|
|
Hi.
I'm using ASP.NET 2.0.
I don't know how to describe this problem profesionally, so I'll try as simple as I can.
When I put DatePicker control to EditItemTemplate in DetailsView on my ContentPage something wrong happen and page seems to be cut. DatePicker is not visible at all, and the rest of page is cut down, starting from where DatePicker were placed.
Has anyone had this kind of problem with DatePicker ?
Best regards, Marcin
|
|
|
|
|
The script block should be placed within the
To do that you need to replace
Page.Response.write(strBuildUp);
with
ASP.NET 2.0
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "scrptDatePicker", strBuildUp);
or
ASP.NET 1.1
Page.RegisterClientScriptBlock("DatePickerScript", strBuildUp);
Sully
|
|
|
|
|
Hey can you mail me the new control with all the corrections to
coolazeem[at]gmail[dot]com. I am doing a project in VS 2005 and I am not able to access the text value of the control to add to my database. pLs help
|
|
|
|
|
Hi there, could someone please email me a workable version of this datepicker control? using the former modified version from your suggested correction, i could finally read the date and display correctly. however, after a postback, all the input was lost... the javascript version you provided i seem to have problem to copy and paste from this forum.
if u could email me a workable version to ccf_lau@yahoo.com(ccf_lau <at> yahoo dot com), it would be much appreciated.
thank you so much for the help and fix...
-- modified at 20:50 Friday 3rd March, 2006
|
|
|
|
|
Ok... all you have to do is take off the readonly property on the textbox... When .net rebuilds the textbox on postback.. it knows that in the viewstate the textbox is readonly and cannot be changed. So the value of the text is not rebuilt into the control. The code supplied in the download is correct and works. Make the modification I show above and then take off the readonly and it works great.
Sully
|
|
|
|
|
Good job , thanks.
|
|
|
|
|
Hi,
I have been using your control for sometime now, and I think it's great. It is working fine with .Net 2 also. The problem I'm having is that when I place it in a aspx page that uses Master pages the .Text value is returned blank.
Do you have a fix?
Thanks
Chris
|
|
|
|
|
Hi Chris
Yes - I do have a fix - but this control needs to be rewritten from scratch anyway (working on it at the moment).
Will repost as soon as it's complete.
Cheers
Doug Wilson
|
|
|
|
|
Hi Doug,
I thank you for your reply. I do not want to sound annoying, however when do you think this will be available? Unfortunately I changed a large portion of our internal software before relising that there was an issue with the datepicker and it's kind of difficult to roleback.
Thanks
Christian Ransley BSc.
|
|
|
|
|
Just comment out
txtTextBox.ReadOnly = true;
Then add another javascript event that restricts values to be typed in.
Sully
-- modified at 1:34 Sunday 19th February, 2006
|
|
|
|
|
Chris,
I've been trying to get the code to work for sometime now. Everything looks okay, but the textbox value is not being passed to my update parameter (it is always null). Can you post the code that you've been using, or perhaps provide a suggestion?
Also, you may email the code to me if you would like at RGoodman@charter.net.
Many thanks,
Robert
|
|
|
|
|
Hello,
I fixed this control before by using the findcontrol method rather than just an index position but it broke when I tried it in my new ASP.NET 2.0 app. I used this as an excuse to make some improvements and fix it.
I have changed the method from building up the javascript to use a string builder which should speed things up quite a bit and also used the render method rather than composition which should make things faster but also means it works fine in asp.net v2. I've posted my code below, if anyone spots a problem with it then let me know.
Hope this helps!
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Collections.Specialized;
using System.Text;
namespace EblocControls
{
/// <summary>
/// Summary description for WebCustomControl1.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")]
public class DatePicker : WebControl, INamingContainer,IPostBackDataHandler
{
#region Private Properties
private string m_closeGif = "close.gif";
private string m_dividerGif = "divider.gif";
private string m_drop1Gif = "drop1.gif";
private string m_drop2Gif = "drop2.gif";
private string m_left1Gif = "left1.gif";
private string m_left2Gif = "left2.gif";
private string m_right1Gif = "right1.gif";
private string m_right2Gif = "right2.gif";
private string m_imgDirectory = "/img/";
private string m_ControlCssClass = "";
private string m_text = "";
private string m_Css = "";
private string m_DateType = "dd mmm yyyy";
#endregion
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
Page.RegisterRequiresPostBack(this);
}
#region Public Properties
public string Text
{
get
{
return m_text;
}
set
{
m_text = value;
}
}
public virtual bool LoadPostData(string postDataKey, NameValueCollection values)
{
Page.Response.Write("Load post data has been hit"+UniqueID + "_DatePicker");
try
{
m_text = values[UniqueID + "_DatePicker"].ToString();
}
catch (Exception)
{
m_text ="working";
}
return false;
}
public virtual void RaisePostDataChangedEvent()
{
}
public override string CssClass
{
get
{
return m_Css;
}
set
{
m_Css = value;
}
}
public string imgClose
{
get {return m_closeGif;}
set {m_closeGif = value;}
}
public string imgDivider
{
get {return m_dividerGif;}
set {m_dividerGif = value;}
}
public string imgDrop1
{
get {return m_drop1Gif;}
set {m_drop1Gif = value;}
}
public string imgDrop2
{
get {return m_drop2Gif;}
set {m_drop2Gif = value;}
}
public string imgLeft1
{
get {return m_left1Gif;}
set {m_left1Gif = value;}
}
public string imgLeft2
{
get {return m_left2Gif;}
set {m_left2Gif = value;}
}
public string imgRight1
{
get {return m_right1Gif;}
set {m_right1Gif = value;}
}
public string imgDirectory
{
get {return m_imgDirectory;}
set {m_imgDirectory = value;}
}
public string ControlCssClass
{
get {return m_ControlCssClass;}
set {m_ControlCssClass = value;}
}
public string DateType
{
get {return m_DateType;}
set {m_DateType = value;}
}
#endregion
#region Constructors
public DatePicker()
{
//
// TODO: Add constructor logic here
//
}
#endregion
#region Private Methods/Properties
private void placeJavascript()
{
StringBuilder sbJavascript = new StringBuilder();
sbJavascript.Append("<script type=\"text/javascript\">");
sbJavascript.Append("// written by Tan Ling Wee on 2 Dec 2001\n");
sbJavascript.Append("// last updated 23 June 2002\n");
sbJavascript.Append("// email : fuushikaden@yahoo.com\n\n");
sbJavascript.Append("var fixedX = -1 // x position (-1 if to appear below control)\n");
sbJavascript.Append("var fixedY = -1 // y position (-1 if to appear below control)\n");
sbJavascript.Append("var startAt = 1 // 0 - sunday ; 1 - monday\n");
sbJavascript.Append("var showWeekNumber = 1 // 0 - don't show; 1 - show\n");
sbJavascript.Append("var showToday = 1 // 0 - don't show; 1 - show\n");
sbJavascript.Append(@"var imgDir = """ + m_imgDirectory + @"""" + "\n");
sbJavascript.Append(@"var gotoString = ""Go To Current Month""" + "\n");
sbJavascript.Append(@"var todayString = ""Today is""" + "\n");
sbJavascript.Append(@"var weekString = ""Wk""" + "\n");
sbJavascript.Append(@"var scrollLeftMessage = ""Click to scroll to previous month. Hold mouse button to scroll automatically.""" + "\n");
sbJavascript.Append(@"var scrollRightMessage = ""Click to scroll to next month. Hold mouse button to scroll automatically.""" + "\n");
sbJavascript.Append(@"var selectMonthMessage = ""Click to select a month.""" + "\n");
sbJavascript.Append(@"var selectYearMessage = ""Click to select a year.""" + "\n");
sbJavascript.Append(@"var selectDateMessage = ""Select [date] as date."" // do not replace [date], it will be replaced by date." + "\n");
sbJavascript.Append("var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear\n\n");
sbJavascript.Append("var bPageLoaded=false\n");
sbJavascript.Append("var ie=document.all\n");
sbJavascript.Append("var dom=document.getElementById\n\n");
sbJavascript.Append("var ns4=document.layers\n");
sbJavascript.Append("var today = new Date()\n");
sbJavascript.Append("var dateNow = today.getDate()\n");
sbJavascript.Append("var monthNow = today.getMonth()\n");
sbJavascript.Append("var yearNow = today.getYear()\n");
sbJavascript.Append(@"var imgsrc = new Array(""" + m_drop1Gif + @""",""" + m_drop2Gif + @""",""" + m_left1Gif + @""",""" + m_left2Gif + @""",""" + m_right1Gif + @""",""" + m_right2Gif + @""")" + "\n");
sbJavascript.Append("var img = new Array()\n\n");
sbJavascript.Append("var bShow = false;\n\n");
sbJavascript.Append("/* hides <select> and <applet> objects (for IE only) */\n");
sbJavascript.Append("function hideElement( elmID, overDiv )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if( ie )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("for( i = 0; i < document.all.tags( elmID ).length; i++ )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("obj = document.all.tags( elmID )[i];\n");
sbJavascript.Append("if( !obj || !obj.offsetParent )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("continue;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("// Find the element's offsetTop and offsetLeft relative to the BODY tag.\n");
sbJavascript.Append("objLeft = obj.offsetLeft;\n");
sbJavascript.Append("objTop = obj.offsetTop;\n");
sbJavascript.Append("objParent = obj.offsetParent;\n\n");
sbJavascript.Append(@"while( objParent.tagName.toUpperCase() != ""BODY"" )" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("objLeft += objParent.offsetLeft;\n");
sbJavascript.Append("objTop += objParent.offsetTop;\n");
sbJavascript.Append("objParent = objParent.offsetParent;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("objHeight = obj.offsetHeight;\n");
sbJavascript.Append("objWidth = obj.offsetWidth;\n\n");
sbJavascript.Append("if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );\n");
sbJavascript.Append("else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );\n");
sbJavascript.Append("else if( overDiv.offsetTop >= ( objTop + objHeight ));\n");
sbJavascript.Append("else if( overDiv.offsetLeft >= ( objLeft + objWidth ));\n");
sbJavascript.Append("else\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"obj.style.visibility = ""hidden"";" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("/*\n");
sbJavascript.Append("* unhides <select> and <applet> objects (for IE only)\n");
sbJavascript.Append("*/\n");
sbJavascript.Append("function showElement( elmID )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if( ie )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("for( i = 0; i < document.all.tags( elmID ).length; i++ )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("obj = document.all.tags( elmID )[i];\n\n");
sbJavascript.Append("if( !obj || !obj.offsetParent )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("continue;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"obj.style.visibility = """";" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function HolidayRec (d, m, y, desc)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("this.d = d\n");
sbJavascript.Append("this.m = m\n");
sbJavascript.Append("this.y = y\n");
sbJavascript.Append("this.desc = desc\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("var HolidaysCounter = 0\n");
sbJavascript.Append("var Holidays = new Array()\n\n");
sbJavascript.Append("function addHoliday (d, m, y, desc)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("Holidays[HolidaysCounter++] = new HolidayRec ( d, m, y, desc )\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("if (dom)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("for (i=0;i<imgsrc.length;i++)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("img[i] = new Image\n");
sbJavascript.Append("img[i].src = imgDir + imgsrc[i]\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"document.write (""<div onclick='bShow=true' id='calendar' style='z-index:+999;position:absolute;visibility:hidden;'><table width=""+((showWeekNumber==1)?250:220)+"" style='font-family:arial;font-size:11px;border-width:1;border-style:solid;border-color:#a0a0a0;font-family:arial; font-size:11px}' bgcolor='#ffffff'><tr bgcolor='#0000aa'><td><table width='""+((showWeekNumber==1)?248:218)+""'><tr><td style='padding:2px;font-family:arial; font-size:11px;'><font color='#ffffff'><B><span id='caption'></span></B></font></td><td align=right><a href='javascript:hideCalendar()'><IMG SRC='""+imgDir+""" + m_closeGif + @"' WIDTH='15' HEIGHT='13' BORDER='0' ALT='Close the Calendar'></a></td></tr></table></td></tr><tr><td style='padding:5px' bgcolor=#ffffff><span id='content'></span></td></tr>"")" + "\n\n");
sbJavascript.Append("if (showToday==1)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"document.write (""<tr bgcolor=#f0f0f0><td style='padding:5px' align=center><span id='lblToday'></span></td></tr>"")" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"document.write (""</table></div><div id='selectMonth' style='z-index:+999;position:absolute;visibility:hidden;'></div><div id='selectYear' style='z-index:+999;position:absolute;visibility:hidden;'></div>"");" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"var monthName = new Array(""January"",""February"",""March"",""April"",""May"",""June"",""July"",""August"",""September"",""October"",""November"",""December"")" + "\n");
sbJavascript.Append("if (startAt==0)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"dayName = new Array (""Sun"",""Mon"",""Tue"",""Wed"",""Thu"",""Fri"",""Sat"")" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("else\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"dayName = new Array (""Mon"",""Tue"",""Wed"",""Thu"",""Fri"",""Sat"",""Sun"")" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"var styleAnchor=""text-decoration:none;color:black;""" + "\n");
sbJavascript.Append(@"var styleLightBorder=""border-style:solid;border-width:1px;border-color:#a0a0a0;""" + "\n\n");
sbJavascript.Append("function swapImage(srcImg, destImg){\n");
sbJavascript.Append(@"if (ie) { document.getElementById(srcImg).setAttribute(""src"",imgDir + destImg) }" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function init() {\n");
sbJavascript.Append("if (!ns4)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if (!ie) { yearNow += 1900 }\n\n");
sbJavascript.Append(@"crossobj=(dom)?document.getElementById(""calendar"").style : ie? document.all.calendar : document.calendar" + "\n");
sbJavascript.Append("hideCalendar()\n\n");
sbJavascript.Append(@"crossMonthObj=(dom)?document.getElementById(""selectMonth"").style : ie? document.all.selectMonth : document.selectMonth" + "\n\n");
sbJavascript.Append(@"crossYearObj=(dom)?document.getElementById(""selectYear"").style : ie? document.all.selectYear : document.selectYear" + "\n\n");
sbJavascript.Append("monthConstructed=false;\n");
sbJavascript.Append("yearConstructed=false;\n\n");
sbJavascript.Append("if (showToday==1)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"document.getElementById(""lblToday"").innerHTML = todayString + "" <a onmousemove='window.status=\""""+gotoString+""\""' onmouseout='window.status=\""\""' title='""+gotoString+""' style='""+styleAnchor+""' href='javascript:monthSelected=monthNow;yearSelected=yearNow;constructCalendar();'>""+dayName[(today.getDay()-startAt==-1)?6:(today.getDay()-startAt)]+"", "" + dateNow + "" "" + monthName[monthNow].substring(0,3) + "" "" + yearNow + ""</a>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"sHTML1=""<span id='spanLeft' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\""changeLeft\"",\""left2.gif\"");this.style.borderColor=\""#88AAFF\"";window.status=\""""+scrollLeftMessage+""\""' onclick='javascript:decMonth()' onmouseout='clearInterval(intervalID1);swapImage(\""changeLeft\"",\""left1.gif\"");this.style.borderColor=\""#3366FF\"";window.status=\""\""' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\""StartDecMonth()\"",500)' onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'> <IMG id='changeLeft' SRC='""+imgDir+""left1.gif' width=10 height=11 BORDER=0> </span> """ + "\n");
sbJavascript.Append(@"sHTML1+=""<span id='spanRight' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\""changeRight\"",\""right2.gif\"");this.style.borderColor=\""#88AAFF\"";window.status=\""""+scrollRightMessage+""\""' onmouseout='clearInterval(intervalID1);swapImage(\""changeRight\"",\""right1.gif\"");this.style.borderColor=\""#3366FF\"";window.status=\""\""' onclick='incMonth()' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\""StartIncMonth()\"",500)' onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'> <IMG id='changeRight' SRC='""+imgDir+""right1.gif' width=10 height=11 BORDER=0> </span> """ + "\n");
sbJavascript.Append(@"sHTML1+=""<span id='spanMonth' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\""changeMonth\"",\""drop2.gif\"");this.style.borderColor=\""#88AAFF\"";window.status=\""""+selectMonthMessage+""\""' onmouseout='swapImage(\""changeMonth\"",\""drop1.gif\"");this.style.borderColor=\""#3366FF\"";window.status=\""\""' onclick='popUpMonth()'></span> """ + "\n");
sbJavascript.Append(@"sHTML1+=""<span id='spanYear' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\""changeYear\"",\""drop2.gif\"");this.style.borderColor=\""#88AAFF\"";window.status=\""""+selectYearMessage+""\""' onmouseout='swapImage(\""changeYear\"",\""drop1.gif\"");this.style.borderColor=\""#3366FF\"";window.status=\""\""' onclick='popUpYear()'></span> """ + "\n\n");
sbJavascript.Append(@"document.getElementById(""caption"").innerHTML = sHTML1" + "\n\n");
sbJavascript.Append("bPageLoaded=true\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function hideCalendar() {\n");
sbJavascript.Append(@"crossobj.visibility=""hidden""" + "\n");
sbJavascript.Append(@"if (crossMonthObj != null){crossMonthObj.visibility=""hidden""}" + "\n");
sbJavascript.Append(@"if (crossYearObj != null){crossYearObj.visibility=""hidden""}" + "\n\n");
sbJavascript.Append("showElement( 'SELECT' );\n");
sbJavascript.Append("showElement( 'APPLET' );\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function padZero(num) {\n");
sbJavascript.Append("return (num < 10)? '0' + num : num ;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function constructDate(d,m,y)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("sTmp = dateFormat\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""dd"",""<e>"")" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""d"",""<d>"")" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""<e>"",padZero(d))" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""<d>"",d)" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""mmm"",""<o>"")" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""mm"",""<n>"")" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""m"",""<m>"")" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""<m>"",m+1)" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""<n>"",padZero(m+1))" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""<o>"",monthName[m])" + "\n");
sbJavascript.Append(@"return sTmp.replace (""yyyy"",y)" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function closeCalendar() {\n");
sbJavascript.Append("var sTmp\n\n");
sbJavascript.Append("hideCalendar();\n");
sbJavascript.Append("ctlToPlaceValue.value = constructDate(dateSelected,monthSelected,yearSelected)\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("/*** Month Pulldown ***/\n\n");
sbJavascript.Append("function StartDecMonth()\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"intervalID1=setInterval(""decMonth()"",80)" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function StartIncMonth()\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"intervalID1=setInterval(""incMonth()"",80)" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function incMonth () {\n");
sbJavascript.Append("monthSelected++\n");
sbJavascript.Append("if (monthSelected>11) {\n");
sbJavascript.Append("monthSelected=0\n");
sbJavascript.Append("yearSelected++\n");
sbJavascript.Append("}\n");
sbJavascript.Append("constructCalendar()\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function decMonth () {\n");
sbJavascript.Append("monthSelected--\n");
sbJavascript.Append("if (monthSelected<0) {\n");
sbJavascript.Append("monthSelected=11\n");
sbJavascript.Append("yearSelected--\n");
sbJavascript.Append("}\n");
sbJavascript.Append("constructCalendar()\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function constructMonth() {\n");
sbJavascript.Append("popDownYear()\n");
sbJavascript.Append("if (!monthConstructed) {\n");
sbJavascript.Append(@"sHTML = """"" + "\n");
sbJavascript.Append("for (i=0; i<12; i++) {\n");
sbJavascript.Append("sName = monthName[i];\n");
sbJavascript.Append("if (i==monthSelected){\n");
sbJavascript.Append(@"sName = ""<B>"" + sName + ""</B>""" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"sHTML += ""<tr><td id='m"" + i + ""' onmouseover='this.style.backgroundColor=\""#353aff\""' onmouseout='this.style.backgroundColor=\""\""' style='cursor:pointer' onclick='monthConstructed=false;monthSelected="" + i + "";constructCalendar();popDownMonth();event.cancelBubble=true'> "" + sName + "" </td></tr>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"document.getElementById(""selectMonth"").innerHTML = ""<table width=70 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#3366ff' cellspacing=0 onmouseover='clearTimeout(timeoutID1)' onmouseout='clearTimeout(timeoutID1);timeoutID1=setTimeout(\""popDownMonth()\"",100);event.cancelBubble=true'>"" + sHTML + ""</table>""" + "\n\n");
sbJavascript.Append("monthConstructed=true\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function popUpMonth() {\n");
sbJavascript.Append("constructMonth()\n");
sbJavascript.Append(@"crossMonthObj.visibility = (dom||ie)? ""visible"" : ""show""" + "\n");
sbJavascript.Append("crossMonthObj.left = parseInt(crossobj.left) + 50\n");
sbJavascript.Append("crossMonthObj.top = parseInt(crossobj.top) + 26\n\n");
sbJavascript.Append(@"hideElement( 'SELECT', document.getElementById(""selectMonth"") );" + "\n");
sbJavascript.Append(@"hideElement( 'APPLET', document.getElementById(""selectMonth"") );" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function popDownMonth() {\n");
sbJavascript.Append(@"crossMonthObj.visibility= ""hidden""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("/*** Year Pulldown ***/\n\n");
sbJavascript.Append("function incYear() {\n");
sbJavascript.Append("for (i=0; i<7; i++){\n");
sbJavascript.Append("newYear = (i+nStartingYear)+1\n");
sbJavascript.Append("if (newYear==yearSelected)\n");
sbJavascript.Append(@"{ txtYear = "" <B>"" + newYear + ""</B> "" }" + "\n");
sbJavascript.Append("else\n");
sbJavascript.Append(@"{ txtYear = "" "" + newYear + "" "" }" + "\n");
sbJavascript.Append(@"document.getElementById(""y""+i).innerHTML = txtYear" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("nStartingYear ++;\n");
sbJavascript.Append("bShow=true\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function decYear() {\n");
sbJavascript.Append("for (i=0; i<7; i++){\n");
sbJavascript.Append("newYear = (i+nStartingYear)-1\n");
sbJavascript.Append("if (newYear==yearSelected)\n");
sbJavascript.Append(@"{ txtYear = "" <B>"" + newYear + ""</B> "" }" + "\n");
sbJavascript.Append("else\n");
sbJavascript.Append(@"{ txtYear = "" "" + newYear + "" "" }" + "\n");
sbJavascript.Append(@"document.getElementById(""y""+i).innerHTML = txtYear" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("nStartingYear --;\n");
sbJavascript.Append("bShow=true\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function selectYear(nYear) {\n");
sbJavascript.Append("yearSelected=parseInt(nYear+nStartingYear);\n");
sbJavascript.Append("yearConstructed=false;\n");
sbJavascript.Append("constructCalendar();\n");
sbJavascript.Append("popDownYear();\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function constructYear() {\n");
sbJavascript.Append("popDownMonth()\n");
sbJavascript.Append(@"sHTML = """"" + "\n");
sbJavascript.Append("if (!yearConstructed) {\n\n");
sbJavascript.Append(@"sHTML = ""<tr><td align='center' onmouseover='this.style.backgroundColor=\""#353aff\""' onmouseout='clearInterval(intervalID1);this.style.backgroundColor=\""\""' style='cursor:pointer' onmousedown='clearInterval(intervalID1);intervalID1=setInterval(\""decYear()\"",30)' onmouseup='clearInterval(intervalID1)'>-</td></tr>""" + "\n\n");
sbJavascript.Append("j = 0\n");
sbJavascript.Append("nStartingYear = yearSelected-3\n");
sbJavascript.Append("for (i=(yearSelected-3); i<=(yearSelected+3); i++) {\n");
sbJavascript.Append("sName = i;\n");
sbJavascript.Append("if (i==yearSelected){\n");
sbJavascript.Append(@"sName = ""<B>"" + sName + ""</B>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"sHTML += ""<tr><td id='y"" + j + ""' onmouseover='this.style.backgroundColor=\""#353aff\""' onmouseout='this.style.backgroundColor=\""\""' style='cursor:pointer' onclick='selectYear(""+j+"");event.cancelBubble=true'> "" + sName + "" </td></tr>""" + "\n");
sbJavascript.Append("j ++;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"sHTML += ""<tr><td align='center' onmouseover='this.style.backgroundColor=\""#353aff\""' onmouseout='clearInterval(intervalID2);this.style.backgroundColor=\""\""' style='cursor:pointer' onmousedown='clearInterval(intervalID2);intervalID2=setInterval(\""incYear()\"",30)' onmouseup='clearInterval(intervalID2)'>+</td></tr>""" + "\n\n");
sbJavascript.Append(@"document.getElementById(""selectYear"").innerHTML = ""<table width=44 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#3366ff' onmouseover='clearTimeout(timeoutID2)' onmouseout='clearTimeout(timeoutID2);timeoutID2=setTimeout(\""popDownYear()\"",100)' cellspacing=0>"" + sHTML + ""</table>""" + "\n\n");
sbJavascript.Append("yearConstructed = true\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("function popDownYear() {\n");
sbJavascript.Append("clearInterval(intervalID1)\n");
sbJavascript.Append("clearTimeout(timeoutID1)\n");
sbJavascript.Append("clearInterval(intervalID2)\n");
sbJavascript.Append("clearTimeout(timeoutID2)\n");
sbJavascript.Append(@"crossYearObj.visibility= ""hidden""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function popUpYear() {\n");
sbJavascript.Append("var leftOffset\n\n");
sbJavascript.Append("constructYear()\n");
sbJavascript.Append(@"crossYearObj.visibility = (dom||ie)? ""visible"" : ""show""" + "\n");
sbJavascript.Append(@"leftOffset = parseInt(crossobj.left) + document.getElementById(""spanYear"").offsetLeft" + "\n");
sbJavascript.Append("if (ie)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("leftOffset += 6\n");
sbJavascript.Append("}\n");
sbJavascript.Append("crossYearObj.left = leftOffset\n");
sbJavascript.Append("crossYearObj.top = parseInt(crossobj.top) + 26\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("/*** calendar ***/\n");
sbJavascript.Append("function WeekNbr(n) {\n");
sbJavascript.Append("// Algorithm used:\n");
sbJavascript.Append("// From Klaus Tondering's Calendar document (The Authority/Guru)\n");
sbJavascript.Append("// hhtp://www.tondering.dk/claus/calendar.html\n");
sbJavascript.Append("// a = (14-month) / 12\n");
sbJavascript.Append("// y = year + 4800 - a\n");
sbJavascript.Append("// m = month + 12a - 3\n");
sbJavascript.Append("// J = day + (153m + 2) / 5 + 365y + y / 4 - y / 100 + y / 400 - 32045\n");
sbJavascript.Append("// d4 = (J + 31741 - (J mod 7)) mod 146097 mod 36524 mod 1461\n");
sbJavascript.Append("// L = d4 / 1460\n");
sbJavascript.Append("// d1 = ((d4 - L) mod 365) + L\n");
sbJavascript.Append("// WeekNumber = d1 / 7 + 1\n\n");
sbJavascript.Append("year = n.getFullYear();\n");
sbJavascript.Append("month = n.getMonth() + 1;\n");
sbJavascript.Append("if (startAt == 0) {\n");
sbJavascript.Append("day = n.getDate() + 1;\n");
sbJavascript.Append("}\n");
sbJavascript.Append("else {\n");
sbJavascript.Append("day = n.getDate();\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("a = Math.floor((14-month) / 12);\n");
sbJavascript.Append("y = year + 4800 - a;\n");
sbJavascript.Append("m = month + 12 * a - 3;\n");
sbJavascript.Append("b = Math.floor(y/4) - Math.floor(y/100) + Math.floor(y/400);\n");
sbJavascript.Append("J = day + Math.floor((153 * m + 2) / 5) + 365 * y + b - 32045;\n");
sbJavascript.Append("d4 = (((J + 31741 - (J % 7)) % 146097) % 36524) % 1461;\n");
sbJavascript.Append("L = Math.floor(d4 / 1460);\n");
sbJavascript.Append("d1 = ((d4 - L) % 365) + L;\n");
sbJavascript.Append("week = Math.floor(d1/7) + 1;\n\n");
sbJavascript.Append("return week;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function constructCalendar () {\n");
sbJavascript.Append("var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31)\n\n");
sbJavascript.Append("var dateMessage\n");
sbJavascript.Append("var startDate = new Date (yearSelected,monthSelected,1)\n");
sbJavascript.Append("var endDate\n\n");
sbJavascript.Append("if (monthSelected==1)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("endDate = new Date (yearSelected,monthSelected+1,1);\n");
sbJavascript.Append("endDate = new Date (endDate - (24*60*60*1000));\n");
sbJavascript.Append("numDaysInMonth = endDate.getDate()\n");
sbJavascript.Append("}\n");
sbJavascript.Append("else\n");
sbJavascript.Append("{\n");
sbJavascript.Append("numDaysInMonth = aNumDays[monthSelected];\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("datePointer = 0\n");
sbJavascript.Append("dayPointer = startDate.getDay() - startAt\n\n");
sbJavascript.Append("if (dayPointer<0)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("dayPointer = 6\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"sHTML = ""<table border=0 style='font-family:verdana;font-size:10px;'><tr>""" + "\n\n");
sbJavascript.Append("if (showWeekNumber==1)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"sHTML += ""<td width=27><b>"" + weekString + ""</b></td><td width=1 rowspan=7 bgcolor='#d0d0d0' style='padding:0px'><img src='""+imgDir+""" + m_dividerGif + @"' width=1></td>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("for (i=0; i<7; i++) {\n");
sbJavascript.Append(@"sHTML += ""<td width='27' align='right'><B>""+ dayName[i]+""</B></td>""" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"sHTML +=""</tr><tr>""" + "\n\n");
sbJavascript.Append("if (showWeekNumber==1)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"sHTML += ""<td align=right>"" + WeekNbr(startDate) + "" </td>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("for ( var i=1; i<=dayPointer;i++ )\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"sHTML += ""<td> </td>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("for ( datePointer=1; datePointer<=numDaysInMonth; datePointer++ )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("dayPointer++;\n");
sbJavascript.Append(@"sHTML += ""<td align=right>""" + "\n");
sbJavascript.Append("sStyle=styleAnchor\n");
sbJavascript.Append("if ((datePointer==odateSelected) && (monthSelected==omonthSelected) && (yearSelected==oyearSelected))\n");
sbJavascript.Append("{ sStyle+=styleLightBorder }\n\n");
sbJavascript.Append(@"sHint = """"" + "\n");
sbJavascript.Append("for (k=0;k<HolidaysCounter;k++)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if ((parseInt(Holidays[k].d)==datePointer)&&(parseInt(Holidays[k].m)==(monthSelected+1)))\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if ((parseInt(Holidays[k].y)==0)||((parseInt(Holidays[k].y)==yearSelected)&&(parseInt(Holidays[k].y)!=0)))\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"sStyle+=""background-color:#FFDDDD;""" + "\n");
sbJavascript.Append(@"sHint+=sHint==""""?Holidays[k].desc:""\n""+Holidays[k].desc" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"var regexp= /\""/g" + "\n");
sbJavascript.Append(@"sHint=sHint.replace(regexp,""""")" + "\n\n");
sbJavascript.Append(@"dateMessage = ""onmousemove='window.status=\""""+selectDateMessage.replace(""[date]"",constructDate(datePointer,monthSelected,yearSelected))+""\""' onmouseout='window.status=\""\""' """ + "\n\n");
sbJavascript.Append("if ((datePointer==dateNow)&&(monthSelected==monthNow)&&(yearSelected==yearNow))\n");
sbJavascript.Append(@"{ sHTML += ""<b><a ""+dateMessage+"" title=\"""" + sHint + ""\"" style='""+sStyle+""' href='javascript:dateSelected=""+datePointer+"";closeCalendar();'><font color=#ff0000> "" + datePointer + ""</font> </a></b>""}" + "\n");
sbJavascript.Append("else if (dayPointer % 7 == (startAt * -1)+1)\n");
sbJavascript.Append(@"{ sHTML += ""<a ""+dateMessage+"" title=\"""" + sHint + ""\"" style='""+sStyle+""' href='javascript:dateSelected=""+datePointer + "";closeCalendar();'> <font color=#909090>"" + datePointer + ""</font> </a>"" }" + "\n");
sbJavascript.Append("else\n");
sbJavascript.Append(@"{ sHTML += ""<a ""+dateMessage+"" title=\"""" + sHint + ""\"" style='""+sStyle+""' href='javascript:dateSelected=""+datePointer + "";closeCalendar();'> "" + datePointer + "" </a>"" }" + "\n\n");
sbJavascript.Append(@"sHTML += """"" + "\n");
sbJavascript.Append("if ((dayPointer+startAt) % 7 == startAt) {\n");
sbJavascript.Append(@"sHTML += ""</tr><tr>""" + "\n");
sbJavascript.Append("if ((showWeekNumber==1)&&(datePointer<numDaysInMonth))\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"sHTML += ""<td align=right>"" + (WeekNbr(new Date(yearSelected,monthSelected,datePointer+1))) + "" </td>""" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"document.getElementById(""content"").innerHTML = sHTML" + "\n");
sbJavascript.Append(@"document.getElementById(""spanMonth"").innerHTML = "" "" + monthName[monthSelected] + "" <IMG id='changeMonth' SRC='""+imgDir+""drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>""" + "\n");
sbJavascript.Append(@"document.getElementById(""spanYear"").innerHTML = "" "" + yearSelected + "" <IMG id='changeYear' SRC='""+imgDir+""drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function popUpCalendar(ctl, ctl2, format) {\n");
sbJavascript.Append("var leftpos=0\n");
sbJavascript.Append("var toppos=0\n\n");
sbJavascript.Append("if (bPageLoaded)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"if ( crossobj.visibility == ""hidden"" ) {" + "\n");
sbJavascript.Append("ctlToPlaceValue = ctl2\n");
sbJavascript.Append("dateFormat=format;\n\n");
sbJavascript.Append(@"formatChar = "" """ + "\n");
sbJavascript.Append("aFormat = dateFormat.split(formatChar)\n");
sbJavascript.Append("if (aFormat.length<3)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"formatChar = ""/""" + "\n");
sbJavascript.Append("aFormat = dateFormat.split(formatChar)\n");
sbJavascript.Append("if (aFormat.length<3)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"formatChar = "".""" + "\n");
sbJavascript.Append("aFormat = dateFormat.split(formatChar)\n");
sbJavascript.Append("if (aFormat.length<3)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"formatChar = ""-""" + "\n");
sbJavascript.Append("aFormat = dateFormat.split(formatChar)\n");
sbJavascript.Append("if (aFormat.length<3)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("// invalid date format\n");
sbJavascript.Append(@"formatChar=""""" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("tokensChanged = 0\n");
sbJavascript.Append(@"if ( formatChar != """" )" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("// use user's date\n");
sbJavascript.Append("aData = ctl2.value.split(formatChar)\n\n");
sbJavascript.Append("for (i=0;i<3;i++)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"if ((aFormat[i]==""d"") || (aFormat[i]==""dd""))" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("dateSelected = parseInt(aData[i], 10)\n");
sbJavascript.Append("tokensChanged ++\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"else if ((aFormat[i]==""m"") || (aFormat[i]==""mm""))" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("monthSelected = parseInt(aData[i], 10) - 1\n");
sbJavascript.Append("tokensChanged ++\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"else if (aFormat[i]==""yyyy"")" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("yearSelected = parseInt(aData[i], 10)\n");
sbJavascript.Append("tokensChanged ++\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"else if (aFormat[i]==""mmm"")" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("for (j=0; j<12; j++)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if (aData[i]==monthName[j])\n");
sbJavascript.Append("{\n");
sbJavascript.Append("monthSelected=j\n");
sbJavascript.Append("tokensChanged ++\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("if ((tokensChanged!=3)||isNaN(dateSelected)||isNaN(monthSelected)||isNaN(yearSelected))\n");
sbJavascript.Append("{\n");
sbJavascript.Append("dateSelected = dateNow\n");
sbJavascript.Append("monthSelected = monthNow\n");
sbJavascript.Append("yearSelected = yearNow\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("odateSelected=dateSelected\n");
sbJavascript.Append("omonthSelected=monthSelected\n");
sbJavascript.Append("oyearSelected=yearSelected\n\n");
sbJavascript.Append("aTag = ctl\n");
sbJavascript.Append("do {\n");
sbJavascript.Append("aTag = aTag.offsetParent;\n");
sbJavascript.Append("leftpos += aTag.offsetLeft;\n");
sbJavascript.Append("toppos += aTag.offsetTop;\n");
sbJavascript.Append(@"} while(aTag.tagName!=""BODY"");" + "\n\n");
sbJavascript.Append("crossobj.left = fixedX==-1 ? ctl.offsetLeft + leftpos : fixedX\n");
sbJavascript.Append("crossobj.top = fixedY==-1 ? ctl.offsetTop + toppos + ctl.offsetHeight + 2 : fixedY\n");
sbJavascript.Append("constructCalendar (1, monthSelected, yearSelected);\n");
sbJavascript.Append(@"crossobj.visibility=(dom||ie)? ""visible"" : ""show""" + "\n\n");
sbJavascript.Append(@"hideElement( 'SELECT', document.getElementById(""calendar"") );" + "\n");
sbJavascript.Append(@"hideElement( 'APPLET', document.getElementById(""calendar"") );" + "\n\n");
sbJavascript.Append("bShow = true;\n");
sbJavascript.Append("}\n");
sbJavascript.Append("else\n");
sbJavascript.Append("{\n");
sbJavascript.Append("hideCalendar()\n");
sbJavascript.Append("if (ctlNow!=ctl) {popUpCalendar(ctl, ctl2, format)}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("ctlNow = ctl\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("document.onkeypress = function hidecal1 () {\n");
sbJavascript.Append("if (event.keyCode==27)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("hideCalendar()\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("document.onclick = function hidecal2 () {\n");
sbJavascript.Append("if (!bShow)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("hideCalendar()\n");
sbJavascript.Append("}\n");
sbJavascript.Append("bShow = false\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("if(ie)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("init()\n");
sbJavascript.Append("}\n");
sbJavascript.Append("else\n");
sbJavascript.Append("{\n");
sbJavascript.Append("window.onload=init;\n");
sbJavascript.Append("}\n");
sbJavascript.Append("<");
sbJavascript.Append("/");
sbJavascript.Append("script>");
Page.Response.Write(sbJavascript.ToString());
}
protected override void Render(HtmlTextWriter writer)
{
placeJavascript();
writer.Write(@"<input type=""textbox"" name="""+this.ClientID+@"_DatePicker"" value="""+m_text+@""" id="""+this.ClientID+@"_DatePicker"" class="""+m_Css+@""" readonly=""readonly"" onclick=""popUpCalendar(document.all." + this.ClientID + "_DatePicker, document.all." + this.ClientID + "_DatePicker, '" + m_DateType + @"');"" />");
}
#endregion
}
}
|
|
|
|
|
Sorry that one has a bug too, try this...
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Collections.Specialized;
using System.Text;
namespace EblocControls
{
///
/// Summary description for WebCustomControl1.
///
[DefaultProperty("Text"),
ToolboxData("<{0}:WebCustomControl1 runat=server>")]
public class DatePicker : WebControl, INamingContainer,IPostBackDataHandler
{
#region Private Properties
private string m_closeGif = "close.gif";
private string m_dividerGif = "divider.gif";
private string m_drop1Gif = "drop1.gif";
private string m_drop2Gif = "drop2.gif";
private string m_left1Gif = "left1.gif";
private string m_left2Gif = "left2.gif";
private string m_right1Gif = "right1.gif";
private string m_right2Gif = "right2.gif";
private string m_imgDirectory = "/img/";
private string m_ControlCssClass = "";
private string m_text = "";
private string m_Css = "";
private string m_DateType = "dd mmm yyyy";
#endregion
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
Page.RegisterRequiresPostBack(this);
}
#region Public Properties
public string Text
{
get
{
return m_text;
}
set
{
m_text = value;
}
}
public virtual bool LoadPostData(string postDataKey, NameValueCollection values)
{
try
{
m_text = values[UniqueID + "_DatePicker"].ToString();
}
catch (Exception)
{
m_text ="";
}
return false;
}
public virtual void RaisePostDataChangedEvent()
{
}
public override string CssClass
{
get
{
return m_Css;
}
set
{
m_Css = value;
}
}
public string imgClose
{
get {return m_closeGif;}
set {m_closeGif = value;}
}
public string imgDivider
{
get {return m_dividerGif;}
set {m_dividerGif = value;}
}
public string imgDrop1
{
get {return m_drop1Gif;}
set {m_drop1Gif = value;}
}
public string imgDrop2
{
get {return m_drop2Gif;}
set {m_drop2Gif = value;}
}
public string imgLeft1
{
get {return m_left1Gif;}
set {m_left1Gif = value;}
}
public string imgLeft2
{
get {return m_left2Gif;}
set {m_left2Gif = value;}
}
public string imgRight1
{
get {return m_right1Gif;}
set {m_right1Gif = value;}
}
public string imgDirectory
{
get {return m_imgDirectory;}
set {m_imgDirectory = value;}
}
public string ControlCssClass
{
get {return m_ControlCssClass;}
set {m_ControlCssClass = value;}
}
public string DateType
{
get {return m_DateType;}
set {m_DateType = value;}
}
#endregion
#region Constructors
public DatePicker()
{
//
// TODO: Add constructor logic here
//
}
#endregion
#region Private Methods/Properties
private void placeJavascript()
{
StringBuilder sbJavascript = new StringBuilder();
sbJavascript.Append("");
sbJavascript.Append("// written by Tan Ling Wee on 2 Dec 2001\n");
sbJavascript.Append("// last updated 23 June 2002\n");
sbJavascript.Append("// email : fuushikaden@yahoo.com\n\n");
sbJavascript.Append("var fixedX = -1 // x position (-1 if to appear below control)\n");
sbJavascript.Append("var fixedY = -1 // y position (-1 if to appear below control)\n");
sbJavascript.Append("var startAt = 1 // 0 - sunday ; 1 - monday\n");
sbJavascript.Append("var showWeekNumber = 1 // 0 - don't show; 1 - show\n");
sbJavascript.Append("var showToday = 1 // 0 - don't show; 1 - show\n");
sbJavascript.Append(@"var imgDir = """ + m_imgDirectory + @"""" + "\n");
sbJavascript.Append(@"var gotoString = ""Go To Current Month""" + "\n");
sbJavascript.Append(@"var todayString = ""Today is""" + "\n");
sbJavascript.Append(@"var weekString = ""Wk""" + "\n");
sbJavascript.Append(@"var scrollLeftMessage = ""Click to scroll to previous month. Hold mouse button to scroll automatically.""" + "\n");
sbJavascript.Append(@"var scrollRightMessage = ""Click to scroll to next month. Hold mouse button to scroll automatically.""" + "\n");
sbJavascript.Append(@"var selectMonthMessage = ""Click to select a month.""" + "\n");
sbJavascript.Append(@"var selectYearMessage = ""Click to select a year.""" + "\n");
sbJavascript.Append(@"var selectDateMessage = ""Select [date] as date."" // do not replace [date], it will be replaced by date." + "\n");
sbJavascript.Append("var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear\n\n");
sbJavascript.Append("var bPageLoaded=false\n");
sbJavascript.Append("var ie=document.all\n");
sbJavascript.Append("var dom=document.getElementById\n\n");
sbJavascript.Append("var ns4=document.layers\n");
sbJavascript.Append("var today = new Date()\n");
sbJavascript.Append("var dateNow = today.getDate()\n");
sbJavascript.Append("var monthNow = today.getMonth()\n");
sbJavascript.Append("var yearNow = today.getYear()\n");
sbJavascript.Append(@"var imgsrc = new Array(""" + m_drop1Gif + @""",""" + m_drop2Gif + @""",""" + m_left1Gif + @""",""" + m_left2Gif + @""",""" + m_right1Gif + @""",""" + m_right2Gif + @""")" + "\n");
sbJavascript.Append("var img = new Array()\n\n");
sbJavascript.Append("var bShow = false;\n\n");
sbJavascript.Append("/* hides <select> and <applet> objects (for IE only) */\n");
sbJavascript.Append("function hideElement( elmID, overDiv )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if( ie )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("for( i = 0; i < document.all.tags( elmID ).length; i++ )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("obj = document.all.tags( elmID )[i];\n");
sbJavascript.Append("if( !obj || !obj.offsetParent )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("continue;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("// Find the element's offsetTop and offsetLeft relative to the BODY tag.\n");
sbJavascript.Append("objLeft = obj.offsetLeft;\n");
sbJavascript.Append("objTop = obj.offsetTop;\n");
sbJavascript.Append("objParent = obj.offsetParent;\n\n");
sbJavascript.Append(@"while( objParent.tagName.toUpperCase() != ""BODY"" )" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("objLeft += objParent.offsetLeft;\n");
sbJavascript.Append("objTop += objParent.offsetTop;\n");
sbJavascript.Append("objParent = objParent.offsetParent;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("objHeight = obj.offsetHeight;\n");
sbJavascript.Append("objWidth = obj.offsetWidth;\n\n");
sbJavascript.Append("if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );\n");
sbJavascript.Append("else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );\n");
sbJavascript.Append("else if( overDiv.offsetTop >= ( objTop + objHeight ));\n");
sbJavascript.Append("else if( overDiv.offsetLeft >= ( objLeft + objWidth ));\n");
sbJavascript.Append("else\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"obj.style.visibility = ""hidden"";" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("/*\n");
sbJavascript.Append("* unhides <select> and <applet> objects (for IE only)\n");
sbJavascript.Append("*/\n");
sbJavascript.Append("function showElement( elmID )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if( ie )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("for( i = 0; i < document.all.tags( elmID ).length; i++ )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("obj = document.all.tags( elmID )[i];\n\n");
sbJavascript.Append("if( !obj || !obj.offsetParent )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("continue;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"obj.style.visibility = """";" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function HolidayRec (d, m, y, desc)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("this.d = d\n");
sbJavascript.Append("this.m = m\n");
sbJavascript.Append("this.y = y\n");
sbJavascript.Append("this.desc = desc\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("var HolidaysCounter = 0\n");
sbJavascript.Append("var Holidays = new Array()\n\n");
sbJavascript.Append("function addHoliday (d, m, y, desc)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("Holidays[HolidaysCounter++] = new HolidayRec ( d, m, y, desc )\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("if (dom)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("for (i=0;i<imgsrc.length;i++)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("img[i] = new Image\n");
sbJavascript.Append("img[i].src = imgDir + imgsrc[i]\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"document.write (""<div onclick='bShow=true' id='calendar' style='z-index:+999;position:absolute;visibility:hidden;'><table width=""+((showWeekNumber==1)?250:220)+"" style='font-family:arial;font-size:11px;border-width:1;border-style:solid;border-color:#a0a0a0;font-family:arial; font-size:11px}' bgcolor='#ffffff'><tr bgcolor='#0000aa'><td><table width='""+((showWeekNumber==1)?248:218)+""'><tr><td style='padding:2px;font-family:arial; font-size:11px;'><font color='#ffffff'><B><span id='caption'></span></B></font></td><td align=right><a href='javascript:hideCalendar()'><IMG SRC='""+imgDir+""" + m_closeGif + @"' WIDTH='15' HEIGHT='13' BORDER='0' ALT='Close the Calendar'></a></td></tr></table></td></tr><tr><td style='padding:5px' bgcolor=#ffffff><span id='content'></span></td></tr>"")" + "\n\n");
sbJavascript.Append("if (showToday==1)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"document.write (""<tr bgcolor=#f0f0f0><td style='padding:5px' align=center><span id='lblToday'></span></td></tr>"")" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"document.write (""</table></div><div id='selectMonth' style='z-index:+999;position:absolute;visibility:hidden;'></div><div id='selectYear' style='z-index:+999;position:absolute;visibility:hidden;'></div>"");" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"var monthName = new Array(""January"",""February"",""March"",""April"",""May"",""June"",""July"",""August"",""September"",""October"",""November"",""December"")" + "\n");
sbJavascript.Append("if (startAt==0)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"dayName = new Array (""Sun"",""Mon"",""Tue"",""Wed"",""Thu"",""Fri"",""Sat"")" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("else\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"dayName = new Array (""Mon"",""Tue"",""Wed"",""Thu"",""Fri"",""Sat"",""Sun"")" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"var styleAnchor=""text-decoration:none;color:black;""" + "\n");
sbJavascript.Append(@"var styleLightBorder=""border-style:solid;border-width:1px;border-color:#a0a0a0;""" + "\n\n");
sbJavascript.Append("function swapImage(srcImg, destImg){\n");
sbJavascript.Append(@"if (ie) { document.getElementById(srcImg).setAttribute(""src"",imgDir + destImg) }" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function init() {\n");
sbJavascript.Append("if (!ns4)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if (!ie) { yearNow += 1900 }\n\n");
sbJavascript.Append(@"crossobj=(dom)?document.getElementById(""calendar"").style : ie? document.all.calendar : document.calendar" + "\n");
sbJavascript.Append("hideCalendar()\n\n");
sbJavascript.Append(@"crossMonthObj=(dom)?document.getElementById(""selectMonth"").style : ie? document.all.selectMonth : document.selectMonth" + "\n\n");
sbJavascript.Append(@"crossYearObj=(dom)?document.getElementById(""selectYear"").style : ie? document.all.selectYear : document.selectYear" + "\n\n");
sbJavascript.Append("monthConstructed=false;\n");
sbJavascript.Append("yearConstructed=false;\n\n");
sbJavascript.Append("if (showToday==1)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"document.getElementById(""lblToday"").innerHTML = todayString + "" <a onmousemove='window.status=\""""+gotoString+""\""' onmouseout='window.status=\""\""' title='""+gotoString+""' style='""+styleAnchor+""' href='javascript:monthSelected=monthNow;yearSelected=yearNow;constructCalendar();'>""+dayName[(today.getDay()-startAt==-1)?6:(today.getDay()-startAt)]+"", "" + dateNow + "" "" + monthName[monthNow].substring(0,3) + "" "" + yearNow + ""</a>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"sHTML1=""<span id='spanLeft' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\""changeLeft\"",\""left2.gif\"");this.style.borderColor=\""#88AAFF\"";window.status=\""""+scrollLeftMessage+""\""' onclick='javascript:decMonth()' onmouseout='clearInterval(intervalID1);swapImage(\""changeLeft\"",\""left1.gif\"");this.style.borderColor=\""#3366FF\"";window.status=\""\""' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\""StartDecMonth()\"",500)' onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'> <IMG id='changeLeft' SRC='""+imgDir+""left1.gif' width=10 height=11 BORDER=0> </span> """ + "\n");
sbJavascript.Append(@"sHTML1+=""<span id='spanRight' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\""changeRight\"",\""right2.gif\"");this.style.borderColor=\""#88AAFF\"";window.status=\""""+scrollRightMessage+""\""' onmouseout='clearInterval(intervalID1);swapImage(\""changeRight\"",\""right1.gif\"");this.style.borderColor=\""#3366FF\"";window.status=\""\""' onclick='incMonth()' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\""StartIncMonth()\"",500)' onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'> <IMG id='changeRight' SRC='""+imgDir+""right1.gif' width=10 height=11 BORDER=0> </span> """ + "\n");
sbJavascript.Append(@"sHTML1+=""<span id='spanMonth' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\""changeMonth\"",\""drop2.gif\"");this.style.borderColor=\""#88AAFF\"";window.status=\""""+selectMonthMessage+""\""' onmouseout='swapImage(\""changeMonth\"",\""drop1.gif\"");this.style.borderColor=\""#3366FF\"";window.status=\""\""' onclick='popUpMonth()'></span> """ + "\n");
sbJavascript.Append(@"sHTML1+=""<span id='spanYear' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\""changeYear\"",\""drop2.gif\"");this.style.borderColor=\""#88AAFF\"";window.status=\""""+selectYearMessage+""\""' onmouseout='swapImage(\""changeYear\"",\""drop1.gif\"");this.style.borderColor=\""#3366FF\"";window.status=\""\""' onclick='popUpYear()'></span> """ + "\n\n");
sbJavascript.Append(@"document.getElementById(""caption"").innerHTML = sHTML1" + "\n\n");
sbJavascript.Append("bPageLoaded=true\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function hideCalendar() {\n");
sbJavascript.Append(@"crossobj.visibility=""hidden""" + "\n");
sbJavascript.Append(@"if (crossMonthObj != null){crossMonthObj.visibility=""hidden""}" + "\n");
sbJavascript.Append(@"if (crossYearObj != null){crossYearObj.visibility=""hidden""}" + "\n\n");
sbJavascript.Append("showElement( 'SELECT' );\n");
sbJavascript.Append("showElement( 'APPLET' );\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function padZero(num) {\n");
sbJavascript.Append("return (num < 10)? '0' + num : num ;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function constructDate(d,m,y)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("sTmp = dateFormat\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""dd"",""<e>"")" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""d"",""<d>"")" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""<e>"",padZero(d))" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""<d>"",d)" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""mmm"",""<o>"")" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""mm"",""<n>"")" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""m"",""<m>"")" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""<m>"",m+1)" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""<n>"",padZero(m+1))" + "\n");
sbJavascript.Append(@"sTmp = sTmp.replace (""<o>"",monthName[m])" + "\n");
sbJavascript.Append(@"return sTmp.replace (""yyyy"",y)" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function closeCalendar() {\n");
sbJavascript.Append("var sTmp\n\n");
sbJavascript.Append("hideCalendar();\n");
sbJavascript.Append("ctlToPlaceValue.value = constructDate(dateSelected,monthSelected,yearSelected)\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("/*** Month Pulldown ***/\n\n");
sbJavascript.Append("function StartDecMonth()\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"intervalID1=setInterval(""decMonth()"",80)" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function StartIncMonth()\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"intervalID1=setInterval(""incMonth()"",80)" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function incMonth () {\n");
sbJavascript.Append("monthSelected++\n");
sbJavascript.Append("if (monthSelected>11) {\n");
sbJavascript.Append("monthSelected=0\n");
sbJavascript.Append("yearSelected++\n");
sbJavascript.Append("}\n");
sbJavascript.Append("constructCalendar()\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function decMonth () {\n");
sbJavascript.Append("monthSelected--\n");
sbJavascript.Append("if (monthSelected<0) {\n");
sbJavascript.Append("monthSelected=11\n");
sbJavascript.Append("yearSelected--\n");
sbJavascript.Append("}\n");
sbJavascript.Append("constructCalendar()\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function constructMonth() {\n");
sbJavascript.Append("popDownYear()\n");
sbJavascript.Append("if (!monthConstructed) {\n");
sbJavascript.Append(@"sHTML = """"" + "\n");
sbJavascript.Append("for (i=0; i<12; i++) {\n");
sbJavascript.Append("sName = monthName[i];\n");
sbJavascript.Append("if (i==monthSelected){\n");
sbJavascript.Append(@"sName = ""<B>"" + sName + ""</B>""" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"sHTML += ""<tr><td id='m"" + i + ""' onmouseover='this.style.backgroundColor=\""#353aff\""' onmouseout='this.style.backgroundColor=\""\""' style='cursor:pointer' onclick='monthConstructed=false;monthSelected="" + i + "";constructCalendar();popDownMonth();event.cancelBubble=true'> "" + sName + "" </td></tr>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"document.getElementById(""selectMonth"").innerHTML = ""<table width=70 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#3366ff' cellspacing=0 onmouseover='clearTimeout(timeoutID1)' onmouseout='clearTimeout(timeoutID1);timeoutID1=setTimeout(\""popDownMonth()\"",100);event.cancelBubble=true'>"" + sHTML + ""</table>""" + "\n\n");
sbJavascript.Append("monthConstructed=true\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function popUpMonth() {\n");
sbJavascript.Append("constructMonth()\n");
sbJavascript.Append(@"crossMonthObj.visibility = (dom||ie)? ""visible"" : ""show""" + "\n");
sbJavascript.Append("crossMonthObj.left = parseInt(crossobj.left) + 50\n");
sbJavascript.Append("crossMonthObj.top = parseInt(crossobj.top) + 26\n\n");
sbJavascript.Append(@"hideElement( 'SELECT', document.getElementById(""selectMonth"") );" + "\n");
sbJavascript.Append(@"hideElement( 'APPLET', document.getElementById(""selectMonth"") );" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function popDownMonth() {\n");
sbJavascript.Append(@"crossMonthObj.visibility= ""hidden""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("/*** Year Pulldown ***/\n\n");
sbJavascript.Append("function incYear() {\n");
sbJavascript.Append("for (i=0; i<7; i++){\n");
sbJavascript.Append("newYear = (i+nStartingYear)+1\n");
sbJavascript.Append("if (newYear==yearSelected)\n");
sbJavascript.Append(@"{ txtYear = "" <B>"" + newYear + ""</B> "" }" + "\n");
sbJavascript.Append("else\n");
sbJavascript.Append(@"{ txtYear = "" "" + newYear + "" "" }" + "\n");
sbJavascript.Append(@"document.getElementById(""y""+i).innerHTML = txtYear" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("nStartingYear ++;\n");
sbJavascript.Append("bShow=true\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function decYear() {\n");
sbJavascript.Append("for (i=0; i<7; i++){\n");
sbJavascript.Append("newYear = (i+nStartingYear)-1\n");
sbJavascript.Append("if (newYear==yearSelected)\n");
sbJavascript.Append(@"{ txtYear = "" <B>"" + newYear + ""</B> "" }" + "\n");
sbJavascript.Append("else\n");
sbJavascript.Append(@"{ txtYear = "" "" + newYear + "" "" }" + "\n");
sbJavascript.Append(@"document.getElementById(""y""+i).innerHTML = txtYear" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("nStartingYear --;\n");
sbJavascript.Append("bShow=true\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function selectYear(nYear) {\n");
sbJavascript.Append("yearSelected=parseInt(nYear+nStartingYear);\n");
sbJavascript.Append("yearConstructed=false;\n");
sbJavascript.Append("constructCalendar();\n");
sbJavascript.Append("popDownYear();\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function constructYear() {\n");
sbJavascript.Append("popDownMonth()\n");
sbJavascript.Append(@"sHTML = """"" + "\n");
sbJavascript.Append("if (!yearConstructed) {\n\n");
sbJavascript.Append(@"sHTML = ""<tr><td align='center' onmouseover='this.style.backgroundColor=\""#353aff\""' onmouseout='clearInterval(intervalID1);this.style.backgroundColor=\""\""' style='cursor:pointer' onmousedown='clearInterval(intervalID1);intervalID1=setInterval(\""decYear()\"",30)' onmouseup='clearInterval(intervalID1)'>-</td></tr>""" + "\n\n");
sbJavascript.Append("j = 0\n");
sbJavascript.Append("nStartingYear = yearSelected-3\n");
sbJavascript.Append("for (i=(yearSelected-3); i<=(yearSelected+3); i++) {\n");
sbJavascript.Append("sName = i;\n");
sbJavascript.Append("if (i==yearSelected){\n");
sbJavascript.Append(@"sName = ""<B>"" + sName + ""</B>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"sHTML += ""<tr><td id='y"" + j + ""' onmouseover='this.style.backgroundColor=\""#353aff\""' onmouseout='this.style.backgroundColor=\""\""' style='cursor:pointer' onclick='selectYear(""+j+"");event.cancelBubble=true'> "" + sName + "" </td></tr>""" + "\n");
sbJavascript.Append("j ++;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"sHTML += ""<tr><td align='center' onmouseover='this.style.backgroundColor=\""#353aff\""' onmouseout='clearInterval(intervalID2);this.style.backgroundColor=\""\""' style='cursor:pointer' onmousedown='clearInterval(intervalID2);intervalID2=setInterval(\""incYear()\"",30)' onmouseup='clearInterval(intervalID2)'>+</td></tr>""" + "\n\n");
sbJavascript.Append(@"document.getElementById(""selectYear"").innerHTML = ""<table width=44 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#3366ff' onmouseover='clearTimeout(timeoutID2)' onmouseout='clearTimeout(timeoutID2);timeoutID2=setTimeout(\""popDownYear()\"",100)' cellspacing=0>"" + sHTML + ""</table>""" + "\n\n");
sbJavascript.Append("yearConstructed = true\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("function popDownYear() {\n");
sbJavascript.Append("clearInterval(intervalID1)\n");
sbJavascript.Append("clearTimeout(timeoutID1)\n");
sbJavascript.Append("clearInterval(intervalID2)\n");
sbJavascript.Append("clearTimeout(timeoutID2)\n");
sbJavascript.Append(@"crossYearObj.visibility= ""hidden""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function popUpYear() {\n");
sbJavascript.Append("var leftOffset\n\n");
sbJavascript.Append("constructYear()\n");
sbJavascript.Append(@"crossYearObj.visibility = (dom||ie)? ""visible"" : ""show""" + "\n");
sbJavascript.Append(@"leftOffset = parseInt(crossobj.left) + document.getElementById(""spanYear"").offsetLeft" + "\n");
sbJavascript.Append("if (ie)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("leftOffset += 6\n");
sbJavascript.Append("}\n");
sbJavascript.Append("crossYearObj.left = leftOffset\n");
sbJavascript.Append("crossYearObj.top = parseInt(crossobj.top) + 26\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("/*** calendar ***/\n");
sbJavascript.Append("function WeekNbr(n) {\n");
sbJavascript.Append("// Algorithm used:\n");
sbJavascript.Append("// From Klaus Tondering's Calendar document (The Authority/Guru)\n");
sbJavascript.Append("// hhtp://www.tondering.dk/claus/calendar.html\n");
sbJavascript.Append("// a = (14-month) / 12\n");
sbJavascript.Append("// y = year + 4800 - a\n");
sbJavascript.Append("// m = month + 12a - 3\n");
sbJavascript.Append("// J = day + (153m + 2) / 5 + 365y + y / 4 - y / 100 + y / 400 - 32045\n");
sbJavascript.Append("// d4 = (J + 31741 - (J mod 7)) mod 146097 mod 36524 mod 1461\n");
sbJavascript.Append("// L = d4 / 1460\n");
sbJavascript.Append("// d1 = ((d4 - L) mod 365) + L\n");
sbJavascript.Append("// WeekNumber = d1 / 7 + 1\n\n");
sbJavascript.Append("year = n.getFullYear();\n");
sbJavascript.Append("month = n.getMonth() + 1;\n");
sbJavascript.Append("if (startAt == 0) {\n");
sbJavascript.Append("day = n.getDate() + 1;\n");
sbJavascript.Append("}\n");
sbJavascript.Append("else {\n");
sbJavascript.Append("day = n.getDate();\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("a = Math.floor((14-month) / 12);\n");
sbJavascript.Append("y = year + 4800 - a;\n");
sbJavascript.Append("m = month + 12 * a - 3;\n");
sbJavascript.Append("b = Math.floor(y/4) - Math.floor(y/100) + Math.floor(y/400);\n");
sbJavascript.Append("J = day + Math.floor((153 * m + 2) / 5) + 365 * y + b - 32045;\n");
sbJavascript.Append("d4 = (((J + 31741 - (J % 7)) % 146097) % 36524) % 1461;\n");
sbJavascript.Append("L = Math.floor(d4 / 1460);\n");
sbJavascript.Append("d1 = ((d4 - L) % 365) + L;\n");
sbJavascript.Append("week = Math.floor(d1/7) + 1;\n\n");
sbJavascript.Append("return week;\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function constructCalendar () {\n");
sbJavascript.Append("var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31)\n\n");
sbJavascript.Append("var dateMessage\n");
sbJavascript.Append("var startDate = new Date (yearSelected,monthSelected,1)\n");
sbJavascript.Append("var endDate\n\n");
sbJavascript.Append("if (monthSelected==1)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("endDate = new Date (yearSelected,monthSelected+1,1);\n");
sbJavascript.Append("endDate = new Date (endDate - (24*60*60*1000));\n");
sbJavascript.Append("numDaysInMonth = endDate.getDate()\n");
sbJavascript.Append("}\n");
sbJavascript.Append("else\n");
sbJavascript.Append("{\n");
sbJavascript.Append("numDaysInMonth = aNumDays[monthSelected];\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("datePointer = 0\n");
sbJavascript.Append("dayPointer = startDate.getDay() - startAt\n\n");
sbJavascript.Append("if (dayPointer<0)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("dayPointer = 6\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"sHTML = ""<table border=0 style='font-family:verdana;font-size:10px;'><tr>""" + "\n\n");
sbJavascript.Append("if (showWeekNumber==1)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"sHTML += ""<td width=27><b>"" + weekString + ""</b></td><td width=1 rowspan=7 bgcolor='#d0d0d0' style='padding:0px'><img src='""+imgDir+""" + m_dividerGif + @"' width=1></td>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("for (i=0; i<7; i++) {\n");
sbJavascript.Append(@"sHTML += ""<td width='27' align='right'><B>""+ dayName[i]+""</B></td>""" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"sHTML +=""</tr><tr>""" + "\n\n");
sbJavascript.Append("if (showWeekNumber==1)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"sHTML += ""<td align=right>"" + WeekNbr(startDate) + "" </td>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("for ( var i=1; i<=dayPointer;i++ )\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"sHTML += ""<td> </td>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("for ( datePointer=1; datePointer<=numDaysInMonth; datePointer++ )\n");
sbJavascript.Append("{\n");
sbJavascript.Append("dayPointer++;\n");
sbJavascript.Append(@"sHTML += ""<td align=right>""" + "\n");
sbJavascript.Append("sStyle=styleAnchor\n");
sbJavascript.Append("if ((datePointer==odateSelected) && (monthSelected==omonthSelected) && (yearSelected==oyearSelected))\n");
sbJavascript.Append("{ sStyle+=styleLightBorder }\n\n");
sbJavascript.Append(@"sHint = """"" + "\n");
sbJavascript.Append("for (k=0;k<HolidaysCounter;k++)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if ((parseInt(Holidays[k].d)==datePointer)&&(parseInt(Holidays[k].m)==(monthSelected+1)))\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if ((parseInt(Holidays[k].y)==0)||((parseInt(Holidays[k].y)==yearSelected)&&(parseInt(Holidays[k].y)!=0)))\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"sStyle+=""background-color:#FFDDDD;""" + "\n");
sbJavascript.Append(@"sHint+=sHint==""""?Holidays[k].desc:""\n""+Holidays[k].desc" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"var regexp= /\""/g" + "\n");
sbJavascript.Append(@"sHint=sHint.replace(regexp,""""")" + "\n\n");
sbJavascript.Append(@"dateMessage = ""onmousemove='window.status=\""""+selectDateMessage.replace(""[date]"",constructDate(datePointer,monthSelected,yearSelected))+""\""' onmouseout='window.status=\""\""' """ + "\n\n");
sbJavascript.Append("if ((datePointer==dateNow)&&(monthSelected==monthNow)&&(yearSelected==yearNow))\n");
sbJavascript.Append(@"{ sHTML += ""<b><a ""+dateMessage+"" title=\"""" + sHint + ""\"" style='""+sStyle+""' href='javascript:dateSelected=""+datePointer+"";closeCalendar();'><font color=#ff0000> "" + datePointer + ""</font> </a></b>""}" + "\n");
sbJavascript.Append("else if (dayPointer % 7 == (startAt * -1)+1)\n");
sbJavascript.Append(@"{ sHTML += ""<a ""+dateMessage+"" title=\"""" + sHint + ""\"" style='""+sStyle+""' href='javascript:dateSelected=""+datePointer + "";closeCalendar();'> <font color=#909090>"" + datePointer + ""</font> </a>"" }" + "\n");
sbJavascript.Append("else\n");
sbJavascript.Append(@"{ sHTML += ""<a ""+dateMessage+"" title=\"""" + sHint + ""\"" style='""+sStyle+""' href='javascript:dateSelected=""+datePointer + "";closeCalendar();'> "" + datePointer + "" </a>"" }" + "\n\n");
sbJavascript.Append(@"sHTML += """"" + "\n");
sbJavascript.Append("if ((dayPointer+startAt) % 7 == startAt) {\n");
sbJavascript.Append(@"sHTML += ""</tr><tr>""" + "\n");
sbJavascript.Append("if ((showWeekNumber==1)&&(datePointer<numDaysInMonth))\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"sHTML += ""<td align=right>"" + (WeekNbr(new Date(yearSelected,monthSelected,datePointer+1))) + "" </td>""" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append(@"document.getElementById(""content"").innerHTML = sHTML" + "\n");
sbJavascript.Append(@"document.getElementById(""spanMonth"").innerHTML = "" "" + monthName[monthSelected] + "" <IMG id='changeMonth' SRC='""+imgDir+""drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>""" + "\n");
sbJavascript.Append(@"document.getElementById(""spanYear"").innerHTML = "" "" + yearSelected + "" <IMG id='changeYear' SRC='""+imgDir+""drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>""" + "\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("function popUpCalendar(ctl, ctl2, format) {\n");
sbJavascript.Append("var leftpos=0\n");
sbJavascript.Append("var toppos=0\n\n");
sbJavascript.Append("if (bPageLoaded)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"if ( crossobj.visibility == ""hidden"" ) {" + "\n");
sbJavascript.Append("ctlToPlaceValue = ctl2\n");
sbJavascript.Append("dateFormat=format;\n\n");
sbJavascript.Append(@"formatChar = "" """ + "\n");
sbJavascript.Append("aFormat = dateFormat.split(formatChar)\n");
sbJavascript.Append("if (aFormat.length<3)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"formatChar = ""/""" + "\n");
sbJavascript.Append("aFormat = dateFormat.split(formatChar)\n");
sbJavascript.Append("if (aFormat.length<3)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"formatChar = "".""" + "\n");
sbJavascript.Append("aFormat = dateFormat.split(formatChar)\n");
sbJavascript.Append("if (aFormat.length<3)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"formatChar = ""-""" + "\n");
sbJavascript.Append("aFormat = dateFormat.split(formatChar)\n");
sbJavascript.Append("if (aFormat.length<3)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("// invalid date format\n");
sbJavascript.Append(@"formatChar=""""" + "\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("tokensChanged = 0\n");
sbJavascript.Append(@"if ( formatChar != """" )" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("// use user's date\n");
sbJavascript.Append("aData = ctl2.value.split(formatChar)\n\n");
sbJavascript.Append("for (i=0;i<3;i++)\n");
sbJavascript.Append("{\n");
sbJavascript.Append(@"if ((aFormat[i]==""d"") || (aFormat[i]==""dd""))" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("dateSelected = parseInt(aData[i], 10)\n");
sbJavascript.Append("tokensChanged ++\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"else if ((aFormat[i]==""m"") || (aFormat[i]==""mm""))" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("monthSelected = parseInt(aData[i], 10) - 1\n");
sbJavascript.Append("tokensChanged ++\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"else if (aFormat[i]==""yyyy"")" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("yearSelected = parseInt(aData[i], 10)\n");
sbJavascript.Append("tokensChanged ++\n");
sbJavascript.Append("}\n");
sbJavascript.Append(@"else if (aFormat[i]==""mmm"")" + "\n");
sbJavascript.Append("{\n");
sbJavascript.Append("for (j=0; j<12; j++)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("if (aData[i]==monthName[j])\n");
sbJavascript.Append("{\n");
sbJavascript.Append("monthSelected=j\n");
sbJavascript.Append("tokensChanged ++\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("if ((tokensChanged!=3)||isNaN(dateSelected)||isNaN(monthSelected)||isNaN(yearSelected))\n");
sbJavascript.Append("{\n");
sbJavascript.Append("dateSelected = dateNow\n");
sbJavascript.Append("monthSelected = monthNow\n");
sbJavascript.Append("yearSelected = yearNow\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("odateSelected=dateSelected\n");
sbJavascript.Append("omonthSelected=monthSelected\n");
sbJavascript.Append("oyearSelected=yearSelected\n\n");
sbJavascript.Append("aTag = ctl\n");
sbJavascript.Append("do {\n");
sbJavascript.Append("aTag = aTag.offsetParent;\n");
sbJavascript.Append("leftpos += aTag.offsetLeft;\n");
sbJavascript.Append("toppos += aTag.offsetTop;\n");
sbJavascript.Append(@"} while(aTag.tagName!=""BODY"");" + "\n\n");
sbJavascript.Append("crossobj.left = fixedX==-1 ? ctl.offsetLeft + leftpos : fixedX\n");
sbJavascript.Append("crossobj.top = fixedY==-1 ? ctl.offsetTop + toppos + ctl.offsetHeight + 2 : fixedY\n");
sbJavascript.Append("constructCalendar (1, monthSelected, yearSelected);\n");
sbJavascript.Append(@"crossobj.visibility=(dom||ie)? ""visible"" : ""show""" + "\n\n");
sbJavascript.Append(@"hideElement( 'SELECT', document.getElementById(""calendar"") );" + "\n");
sbJavascript.Append(@"hideElement( 'APPLET', document.getElementById(""calendar"") );" + "\n\n");
sbJavascript.Append("bShow = true;\n");
sbJavascript.Append("}\n");
sbJavascript.Append("else\n");
sbJavascript.Append("{\n");
sbJavascript.Append("hideCalendar()\n");
sbJavascript.Append("if (ctlNow!=ctl) {popUpCalendar(ctl, ctl2, format)}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("ctlNow = ctl\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("document.onkeypress = function hidecal1 () {\n");
sbJavascript.Append("if (event.keyCode==27)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("hideCalendar()\n");
sbJavascript.Append("}\n");
sbJavascript.Append("}\n");
sbJavascript.Append("document.onclick = function hidecal2 () {\n");
sbJavascript.Append("if (!bShow)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("hideCalendar()\n");
sbJavascript.Append("}\n");
sbJavascript.Append("bShow = false\n");
sbJavascript.Append("}\n\n");
sbJavascript.Append("if(ie)\n");
sbJavascript.Append("{\n");
sbJavascript.Append("init()\n");
sbJavascript.Append("}\n");
sbJavascript.Append("else\n");
sbJavascript.Append("{\n");
sbJavascript.Append("window.onload=init;\n");
sbJavascript.Append("}\n");
sbJavascript.Append("<");
sbJavascript.Append("/");
sbJavascript.Append("script>");
Page.Response.Write(sbJavascript.ToString());
}
protected override void Render(HtmlTextWriter writer)
{
placeJavascript();
writer.Write(@"<input type=""textbox"" name="""+this.UniqueID+@"_DatePicker"" value="""+m_text+@""" id="""+this.UniqueID+@"_DatePicker"" class="""+m_Css+@""" readonly=""readonly"" onclick=""popUpCalendar(document.all." + this.UniqueID + "_DatePicker, document.all." + this.UniqueID + "_DatePicker, '" + m_DateType + @"');"" />");
}
#endregion
}
}
|
|
|
|
|
HI,
When cutting and pasting the code I get many syntax errors. Can you provide the file for download? Or e-mail it to me?
Thanks
|
|
|
|
|