Ibrahim Shaikh Ibrahim Shaikh - 2 months ago 17
ASP.NET (C#) Question

redirect the page on Java script function alert box (OK) click

below is my java script function on aspx page

<script>
function alert6() {
alert("You Can't Delete This Record");
}
</script>


and use the function on my cs page, i want to redirect the page after the user clicks on OK what i Need to do?

Page.ClientScript.RegisterStartupScript(this.GetType(), "alert5", "alert6();", true);

Answer

Simply if you want to redirect the page just after clicking on Ok button of alert box then try this

<script>
 function alert6() {
  alert("You Can't Delete This Record");
  window.location="Your page";
        }
</script>

and call it

Page.ClientScript.RegisterStartupScript(this.GetType(), "alert5", "alert6();", true);
Comments