creating popup calender in asp.net

megavan

Disciple
I want to create a page with a txtbox and a button which opens up a new window with a calender control. After the date is selected the popup should get closed and the textbox in the calling page should be populated with the selected date.

So far I have created the first page with the following code in the button function:

private void btnDOJ_Click(object sender, System.EventArgs e)
{ Response.Write("<script>window.open('Webform2.aspx', 'mycal', 'menubar=no, width=280, height=250')</script>");

}

Now how do I code the second page so that it returns the date??
I'm using VS.net and C# to do the coding. thanks :huh:
 
Ok finally got it done myself :D

All I had to do was insert the below code into the selection_changed function of the calender on the popup page:

private void calDoj_SelectionChanged(object sender, System.EventArgs e)
{ Response.Write("<script>window.opener.document.forms(0).txtDOJ.value='"+calDoj.SelectedDate.ToShortDateString()+"';self.close()</script>");
}

My solution is the simplest you'll find on the net for doing it in VS.Net :eek:hyeah:
 
Back
Top