i have a submit button which adds data to a DB, id like a pop up window to open after the user clicks the button and the submit operation has been completed... (the pop up window will display the submitted data)

while tesing on a local host i (naively) had the "popup on button click" script added on page load. this worked fine as the submit finished before the popup had time to load, however on a remote host this simply dosent work.

id like a way to run the methods to add data to the DB, then launch the pop up window?

any help would be sooooo much appreciated :)

thanks guys xx

7 Years
Discussion Span
Last Post by patelriki13

Have you considered calling the JavaScript alert function once confirmation of the data insert has been received?

Something like this example here but modified as you need it for your purposes.

Hope this helps :) Please remember to mark solved once your issue is resolved.


thanks for the reply, calling the function after confirmation would be acceptable too. However im unsure how to apply the link you provided to my needs.

any other ideas ? :)


I would use something like the following (I just woke up, I threw it together on the fly, so test it before you rely on it in your finished product):

private void showAlert(bool trueFalse)
        string alertMsg = "";
        if (trueFalse == true)
            alertMsg = "Database update successful";
            alertMsg = "Database update failed";
        ClientScript.RegisterStartupScript(GetType(), "dbAlert", "alert(\'" + alertMsg + "\');", true);

Couple that with having a bool variable determined by the return value of your SQL insert/update (if you're using ExecuteNonQuery you'll get an int value indicating number of lines affected, you can determine from the result whether success was true or false and pass the bool to the procedure I wrote).

Hope that helps :) Please remember to mark solved once your issue is resolved.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.