Hello,
I am opening a calendar popup when user clicks on a button but here I have to click twice to get this calendar. On the 1st click it doe not do anything but on 2nd click it shows up the calendar.
here is my code-
<script type="text/javascript" >
function openCalender_range_start_date() {
window.open('popupcalendar.aspx?textbox=TextBox2', 'cal', 'width=220,height=200,left=270,top=180')
}
and on popupcalendar.aspx-
protected void Change_Date(System.Object sender, System.EventArgs e)
{
if (Request.QueryString["TextBox2"] != "")
{
string strScript =
"<script>window.opener.document.forms(0)." +
Request.QueryString["textbox"].ToString() + ".value = '" +
Calendar1.SelectedDate.ToString("MM/dd/yyyy") +
"';self.close()" +
"</" + "script>";
RegisterClientScriptBlock("Calendar_ChangeDate", strScript);
}
}
and on the button- Button2.Attributes.Add("onclick", "openCalender_range_start_date();");
Can somebody tell me what I am doing wrong?