Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 738
  • Last Modified:

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

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.

1 Solution
Jaime OlivaresSoftware ArchitectCommented:
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:
soapygusAuthor Commented:
Thanks Jaime.

This answer worked for me:

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now