Tags: ajax, ajaxtoolkitmodalpopupextender, appears, aspcalendar, aspnet, causes, inside, modalpopupextender, net

asp:calendar inside ajaxtoolkit:modalpopupextender causes it to close

On .Net » ASP.NET AJAX

3,150 words with 3 Comments; publish: Sun, 06 Jan 2008 06:42:00 GMT; (10078.13, « »)

All --

Please help.

It appears that putting an asp:calendar inside ajaxtoolkit:modalpopupextender causes the modalpopupextender to close.

I don't want that.

I am making a date AND time picker. The enduser needs to select a date (from an asp:calendar control), select a time (from and asp:dropdownlist), and then click on okcontrolid=ConfirmLinkButton or cancelcontrolid=CancelLinkButton.

Therefore, only a click on the ConfirmLinkButton or the CancelLinkButton should close the modalpopupextender.

However, as it is, a click on the asp:calendar also closes the modalpopupextender.

I tried to decouple the date selector control (asp:calendar) and the time selector control (asp:dropdownlist) by moving the dropdownlist outside fo the modalpopupextender and then letting the data-selection event act as the "OK event" to close the dialog. This works great EXCEPT-- it turns out the the change-month-paging event of the calendar control also causes the modalpopupextender to close, so I am essentially stuck with the same issue and Ajax totally fails in this case (unless a solution is provided by some helpful soul).

Ug.

I guess what I want to do is to be able to turn-off the auto-post-back for the asp:calendar's selection-changed and month-changed events-- but, there doesn't seem to be a direct way to do that.

How can this be handled?

Please advise.

Thank you.

-- Mark Kamoski

All Comments

Leave a comment...

  • 3 Comments
    • I have used CalenderExtender which is part of AJAX control toolkit and it works really well within modal popup.

      Can u use that instead regular ASP.NET calendar?

      #1; Sun, 06 Jan 2008 06:43:00 GMT
    • Lav --

      Yes, I thought of that too.

      Maybe, just maybe, I will try that.

      However, I have been using Ajax for a while now and I have found A LOT of hidden issues-- this asp:calendar auto-post-back being the latest.

      Furthermore, I have tried to add one Ajax control (the modal extender) and that breaks my code-- which reduces my confidence that adding yet another Ajax control will fix the problem rather than compound it. That is, I have found that if Ajax cannot handle a simple version of the design; then, it is probably not going to handle a complex version of the design. And so on.

      In the end, my sentiment with Ajax is that I love it when it works-- but, many times it does not.

      If at all possible, I would really rather solve the problem than code around it, workaround it, do-something-else, etc.

      Thank you for the hint; but, I am still leaving this question as "unanswered" because the root question is very specific-- how to use the asp:calendar control inside an Ajax modal extender.

      Please send along any other helpful thoughts that you may have.

      Thank you.

      -- Mark Kamoski

      #2; Sun, 06 Jan 2008 06:44:00 GMT
    • Hey I have an idea.

      What if you try to put your asp:calender and other associated controls(your textbox and stuff) inside an update panel on modal extender. That way all postback will refresh only that portion of the page wont close your modal popup or refresh your page.

      Let me know if it works for you.

      #3; Sun, 06 Jan 2008 06:45:00 GMT