Inform webpage that popup has closed

I have a textbox on a webpage whose click event opens a calendar popup.

What do I need to do so that the main webpage 'knows' that the popup calendar has been closed?

My overall goal is to:
    1.  Open the popup calendar when the user clicks the texbox
    2.  Return and display the selected date in the textbox on the main page
    3.  Run some code on the main page immediately upon closing the popup

I have 1 and 2 worked out, but am stuck on 3.

(I'm using VB.Net/ C# /Visual Studio 2008)

Please let me know if more info is needed.

Thanks (!)
LVL 61
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mbizupAuthor Commented:
I have tried using the TextChanged event of the textbox that accepts the date from the popup calendar, but that event does not seem to get triggered by the popup writing the date to the textbox on the main page.
the popup should be able to fire a function in the parent with:



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mbizupAuthor Commented:
That makes sense - it sounds like I have been approaching this from the wrong direction.

Does my syntax look okay?

<asp:Button ID="Button1" runat="server" onclick="; self.close();" Text="Button" />

I'm getting a compilation error saying that I'm missing a close parenthesis, but I don't see where.

That is in the markup for my popup calendar.  Am I putting the code in the right place?
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

mbizupAuthor Commented:
Okay - here's a really stupid question.  

My function "Foo()" is currently in the VB.Net code behind the parent form as a public function.  Will it work like that, or do I have to write it in Javascript and put it in the markup?
Are you using AJAX Calendar Extender control?  Use its OnClientHidden property
mbizupAuthor Commented:
Hi CC,

This is the example I was following for the calendar, using the built in VS.Net calendar:

I'll take a look at sites that you posted, too.
As soon as we drift off into asp and vb it leaves me behind.  I'm an open source developer.  However to answer the question, about javascript, yes the recommendation I posted asumes the function is written in javascript in the parent page.

mbizupAuthor Commented:

That was completely brilliant!

My original approach (trying to determine when the popup closed) was backwards.

Using javascript to call a javascript function worked beautifully, when I got rid of the asp tags - which from your last comment, I think needed to be done.

This is what I wound up with:
    // This is in the popup - 
    function fooPopup()
    <button id="Button1" onclick="fooPopup();"></button>

        // This is in the main form - 
        function fooParent() {
            document.getElementById('TextBox1').value = "Aloha";
            // This clicks an asp button --

Open in new window

What is very, very cool - and what I was ultimately trying to get at - is that you can use that to click a command button to run VB.Net or C# functions.

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Response.Write("This Works!!")
    End Sub

Open in new window

I'm just so happy, I could click that button all day!!
mbizupAuthor Commented:
The original concept behind the site was an Expert in something helping an Expert in something else.  A true exchange between Experts.

Glad to help.  :^)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.