This method pop up a window with a calendar control in it.
1)Here is the textbox that I want to fill and the link to open the pop up window
<asp:TextBox id="txtDateDue" tabIndex="11" runat="server"></asp:TextBox>
<A href="javascript:_DatePickerOpener('Form1','txtDateDue');">
<IMG style="WIDTH: 22px; HEIGHT: 17px" height="17" src="images\calendar.jpg" width="22" border="0"></A>
2) Here is the javascript to open the window:
<script language="javascript">
function _DatePickerOpener(varfn,vartn)
{
var OpenCal;
OpenCal="CalControl.aspx?fn="+varfn+"&tn="+vartn
window.open (OpenCal,"Noname", 'scrollbars=yes,status=no,width=275,height=220,resizable=yes,top=0')
}
</script>
3) Here is the calander.aspx
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="CalControl.aspx.vb" Inherits="Web.CalControl" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
</HEAD>
<body onload="CalScript();">
<form runat="server" ID="Form1">
<asp:Calendar id="Calendar1" runat="server" Font-Name="Verdana;Arial" Font-Size="9pt" Height="178px" Width="235px" TodayDayStyle-Font-Bold="True" DayHeaderStyle-Font-Bold="True" BorderStyle="Solid" NextPrevFormat="ShortMonth" BackColor="White" ForeColor="Black" CellSpacing="1" Font-Names="Verdana" BorderColor="Black">
<TodayDayStyle ForeColor="White" BackColor="#999999"></TodayDayStyle>
<DayStyle BackColor="#CCCCCC"></DayStyle>
<NextPrevStyle Font-Size="8pt" Font-Bold="True" ForeColor="White"></NextPrevStyle>
<DayHeaderStyle Font-Size="8pt" Font-Bold="True" Height="8pt" ForeColor="#333333"></DayHeaderStyle>
<SelectedDayStyle ForeColor="White" BackColor="#333399"></SelectedDayStyle>
<TitleStyle Font-Size="12pt" Font-Bold="True" Height="12pt" ForeColor="White" BackColor="#333399"></TitleStyle>
<OtherMonthDayStyle ForeColor="#999999"></OtherMonthDayStyle>
</asp:Calendar>
<INPUT id="txtDate" runat="server" type="hidden">
</form>
<script language="javascript">
function CalScript()
{
if (!(Form1.txtDate.value==""

)
{
window.opener.<%=Request("fn"

%>.<%=Request("tn"

%>.value=Form1.txtDate.value
window.close()
}
}
</script>
</body>
</HTML>
Public Class CalControl
Inherits System.Web.UI.Page
Protected WithEvents txtDate As System.Web.UI.HtmlControls.HtmlInputHidden
Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
If Calendar1.SelectedDates.Count = 1 Then
txtDate.Value = Calendar1.SelectedDate.ToShortDateString
End If
End Sub
End Class
Good Luck