Calender Popup

Calender Popup is javascript popup which is used to open calender in popup window.

Calender Popup

For opening calendar in Popup window you have remove any popup blocker.
This is a very simple and all done by javascript and HttpContext class.

On click of calendar image open popup window and write a code in WebForm1.aspx

if(!IsPostBack)
{
btnDate.Attributes.Add("onclick","javascript:calendar_window=window.open('Calender.aspx?formname=Form1.txtExpDate','GetDate','width=190,height=230');calendar_window.focus();");
}

 

In Calender.aspx write the following code.

private void btnClearDate_Click(object sender, System.EventArgs e)
{
string scr="<script language='javascript'> window.opener."+ HttpContext.Current.Request.QueryString[0] +".value='';window.close();</script>";
Response.Write(scr);
}

private void calStartDate_SelectionChanged(object sender, System.EventArgs e)
{
string dt=calStartDate.SelectedDate.ToString("dd-MM-yyyy");
string scr="<script language='javascript'> window.opener."+ HttpContext.Current.Request.QueryString[0] +".value='"+dt+"';window.close();</script>";
Response.Write(scr);

}

 

 

By Pritam Baldota   Popularity  (2573 Views)