2.0: implementing popup Calendar

R

R.A.M.

Hello,
I need to implement popup calendar in ASP.NET application. I created a
button opening popup calendar on 'master' page:

<asp:Button ID="Calendar" runat="server"
Text=Calendar" OnClientClick=
"window.open('Calendar.aspx', 'Calendar',
'menubar=no, location=no, personalbar=no, status=no, resizable=no,
scrollbars=no, width=200, height=200');" />

Here is Calendar.aspx:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Calendar.aspx.cs" Inherits="CalendarPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl">
<head runat="server">
<title>Calendar</title>
<link rel="Stylesheet" type="text/css" href="Styles.css" />
</head>
<body class="WithBackground">
<form id="Demo" runat="server">
<asp:Calendar ID="Calendar" runat="server"
OnSelectionChanged="Calendar_SelectionChanged" />
</form>
</body>
</html>

And here is Calendar.aspx.cs:

public partial class CalendarPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
Calendar.Attributes.Add("ondblclick", "window.close();");
// NOTE 1: this way I wanted to achieve auto closing of
// calendar window on double click of date; it doesn't work
}
protected void Calendar_SelectionChanged(object sender,
EventArgs e)
{
Cache["BirthDate"] =
Calendar.SelectedDate.ToString().Substring(0, 10);
// NOTE 2: how to transfer this value to 'master' page
// (to be visible WITHOUT refresh)?
}
}

Could you suggest me a solution to the problems described in NOTE 1
and NOTE 2?
Thank you vey much!
/RAM/
 
G

Guest

I am working on one for sale for like $20 if you are interested
http://www.actieve.com/CalendarControl.aspx .Net 2.0 and Javascript with tons
of options, Otherwise I used to do it this way where I would call in
javascript something like this is a onPostback RegisterClientScript

winodw.opener.getElementById('dateifeld').value = '<%= calendar.SelectedDate
%>';
window.close();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top