using System; using System.Data; using System.Drawing; using System.Web; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; public partial class datepicker : System.Web.UI.UserControl { protected System.Web.UI.WebControls.Label lblDate; private static string linkstyle = String.Empty; private static DateTime thedate = DateTime.MinValue; private static string defaulttext = "Select Date"; protected void Page_Load(object sender, System.EventArgs e) { //assign the href property to the link of the control lnkDatePick.HRef="Javascript:PickDate('" + this.ClientID.Replace(":","_") + "');"; Image1.ImageUrl = "~/images/icon_calendar.gif"; //if a date is specified, apply the value to the control if (SelectedDate != DateTime.MinValue) { DateValue.Value = SelectedDate.ToString("dd/MM/yyyy"); } //call the function to add the javascript RegisterJavaScript(); } public void RegisterJavaScript() { string ScriptString = @"