2

I hava an aspx page and I need to response.redirect to the same page. I am doing while clicking on a button. Can i possible to do it in javascript.

I tried window.location=url; . I want to know how <% Response.Redirect(url) %>can be called in javascript?

1
  • 1
    You can't use Response.Redirect from client-side JavaScript - what's wrong with window.location? Commented Dec 3, 2010 at 13:29

3 Answers 3

9

To redirect in javascript you need to use the window.location property:

window.location = '<%= ResolveUrl("~/test.aspx") %>';
Sign up to request clarification or add additional context in comments.

Comments

0

Response.Redirect cannot be called in Javascript, that is a server side bit of code. window.location does effectively the same job.

Comments

0

In your HTML, where you declare your button, add this.

<input type="button" name="submit" value="submit" onclick="window.location(YOUR REDIRECT URL)" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.