C# OnClick -- perform required field validation then close browser window

Posted on 2007-10-21
Last Modified: 2013-11-07
Hello Experts.

I am wanting to close a browser window using C#.  Here's the scenario. I have Request for information form that opens in a new browser window.  Users provide information and click a submit button.  When the submit button is clicked it validates the required fields and then sends an email.

I would like to then provide an alert that says "Your request has been sent" and then close the window.

I've tried adding javascript but it fires before the fields are validated.  

How do I accomplish this.  I will settle for just closing the browser window if the Alert box is too involved.

Question by:soapygus
    LVL 55

    Accepted Solution

    you can invoke a C# method from your onclick event, and do the job in C# instead of javascript.
    Have a look to this article:

    Author Comment

    Thanks Jaime.

    This answer worked for me:

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now