Write this code in the aspx file:
function pickDate(Src,lt)
{
window.open("CalendarPopUp.aspx?src=" + Src, "_blank", "height=160,width=240,left=" + lt + ",top=75," + "location=no,menubar=no,resizable=no,scrollbars=no ,titlebar=no,toolbar=no", true);
}
The above function needs to be called in the specific event of
the textbox :
onkeypress="pickDate('txtFromdt',50);"
In the code behind of CalendarPopUp.aspx write this:
Dim sbScript As New StringBuilder
sbScript.Append("<script language='javascript'>")
sbScript.Append(Environment.NewLine)
sbScript.Append("window.opener.document.forms[0].")
sbScript.Append(Request.QueryString("src"))
sbScript.Append(".value = '") //displays the date selected in calendar in
//the textbox
sbScript.Append(Calendar1.SelectedDate.ToString("d d/MM/yyyy"))
sbScript.Append("';")
sbScript.Append(Environment.NewLine)
sbScript.Append("window.close();")
sbScript.Append(Environment.NewLine)
sbScript.Append("</script>")
RegisterStartupScript("CloseWindow", sbScript.ToString)
PLease note that i had used the above code to invoke the calendar
control on the click of a image. You will have to make some
changes to the code
|