Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 8th, 2004, 09:03 AM
Registered User
Join Date: Oct 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP Calendar control and popups

I am trying to create a rather simple user control using <asp:Calendar></asp:Calendar> which will be used as a popup calendar for let’s say date picker control.
In other words I have a form which contains a textbox that will hold a date which may be selected from the popup calendar that I am trying to create.

The popup is a modal dialog window (window.showModalDialog) so I can make sure that the user either selects a date or simply cancels the operation. The problem is once the user selects a date a new window pops up with an error that the web page could not be found, this problem does not reproduce when using a regular modeless window (window.open). Does anybody have an idea why this is happening and how can I workaround this problem? Or are there other ways to make the <asp:Calendar> control popup automatically rather than being embedded in the page?

Thanks guys

Old October 8th, 2004, 09:57 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts

Someday, someone will think this is an awesome control too.


Old November 5th, 2004, 03:42 PM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

The problem is in the way the browser presents the modal dialog. Unfortunately, postbacks don't work in them. I've also noticed that it's very difficult to refresh a page that you are viewing in a modal dialog. I think it has to do with the way the browser gets the HTML for it. It's almost like it gets the page in the background and then paints the dialog with the contents. If you put a page that takes a long time to load, you'll see the delay very obviously in the time it takes the modal dialog to show up.

The only solution I have found is to create a page that contains a single frame or iframe. That page will be the source page of the dialog, then the source of the i/frame will be your calendar page. Then the postback will work within the inner frame. Of course, this complicates things slightly with the return javascript, but it's just a matter of having the calendar page write out "top.returnValue" instead of "window.returnValue".
Old December 7th, 2004, 06:02 PM
Registered User
Join Date: Oct 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks planoie for your reply, but i did find a solution that works fine, you might wanna try it out.
There are two important things to remember.
1-setting the page target at the top(somewhere between the Head tags).
<base target="_self">.
2- Making sure that the Calendar sends the following back on the
Calendar1_SelectionChanged Event such as:
"protected void Calendar1_SelectionChanged(object sender, System.EventArgs e)
            Response.Write("<script language='javascript'>window.returnValue='" + Calendar1.SelectedDate.ToShortDateString() + "';window.close();</script>");


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP: XML/XSLT/ASP.NET Calendar Control kwilliams XSLT 14 May 8th, 2008 03:43 PM
Calendar like calendar in AJAX in ASP.NET h@ckerz ASP.NET 2.0 Professional 0 February 19th, 2008 12:56 AM
Calendar Control in ASP.NET 2.0 midway11 ASP.NET 1.x and 2.0 Application Design 3 May 11th, 2007 05:26 PM
ASP.NET Calendar Control Client Side Access rodmcleay ASP.NET 1.0 and 1.1 Basics 4 June 17th, 2005 11:45 PM
Calendar control for ASP.NET App mishi ASP.NET 1.x and 2.0 Application Design 2 April 10th, 2005 05:23 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.