How to close an active web form

I have a popup box with a textarea control. The user enters text into the textarea and then clicks a button (on the popup, not the parent) to save.

What I want is to have the sqldatasource do an update (I know how to do that) and then close the popup window. I have tried several metthods that I found on the web but nothing seems to work. Any Ideas?
lizziesboyAsked:
Who is Participating?

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

x
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.

nap0leonCommented:
To close the current window, in javascript, you can use self.close ();
0
lizziesboyAuthor Commented:
That doesn't seem to work. Plus the question was how to run code in the codebehind and then close the window all from one click of a button on the popup.
0
lizziesboyAuthor Commented:
Mea Culpa. I had "return false;" in the function. (I copied this piece of code from somewhere else. However it asks if I want to close the window. Can I close it without this confirmation?
0
nap0leonCommented:
Not through the code behind... Because its not a user-initiated action.
0
cubaman_24Commented:
Hello:
You can call it from a button. In Page_Load:

cancelButton.Attributes.Add("onclick", "window.close();");

Without button too:
string strscript  = "<script language=javascript>window.close();</script>";
If (!ClientScript.IsStartupScriptRegistered("clientScript")) {
      ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strscript);
}

Best regards.
0

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
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
ASP.NET

From novice to tech pro — start learning today.