i need to show a javascript alert on a button click and after user click ok on alert box i need to redirect to another page.i’m using following code
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ss", "<script>alert('Report Data Not Found ! ')</script>",false);
Response.Redirect(ResolveUrl("~/Reports/Transmittal/OverDueTransmittal/TransmittalReports_Form.aspx"));
currently alert is not shown but it redirects to the next page.if i remove the “Response.Redirect” part it shows the alert.how can i make both these to work at the same time?
Try this:
You might need to tweak the URL a bit. Response.Redirect is a server-side redirect. You need a client-side one, initiated from JavaScript. Setting location.href will do it from JavaScript.