Avatar of mcrmg
mcrmg

asked on 

javascript call

Hi,

For some reason, the code is only "accurate" for the first time you run it. After the second time, it is showing the value that submitted from the previous time, kind of confused.  thanks

    <script type = "text/javascript">
        function Confirm() {
            var confirm_value = document.createElement("INPUT");
            confirm_value.type = "hidden";
            confirm_value.name = "confirm_value";
            if (confirm("Report name exists already. Do you want to replace this report?")) {
                confirm_value.value = "Yes";
            } else {
                confirm_value.value = "No";
            }
            document.forms[0].appendChild(confirm_value);
        }
    </script>

 <asp:Button id="SaveReportbtn" onclick="SaveReportbtn_Click"  CustomParameter="listBox1" runat="server" text="Save Report" />Report" />

Open in new window



                    ScriptManager.RegisterStartupScript(this, GetType(), "myFunction", "Confirm();", true);     

                    string confirmValue = Request.Form["confirm_value"];
                    if (confirmValue == "Yes")
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked YES!')", true);
                     
                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked NO!')", true);
                     


                    }

Open in new window

ASP.NET

Avatar of undefined
Last Comment
mcrmg

8/22/2022 - Mon