Hi,

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

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";
        }
        else
        {
            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.

good one..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.