开发者

Redirecting to another page using C# Response.Redirect in javascript

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.Redi开发者_如何学JAVArect(url) %>can be called in javascript?


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

window.location = '<%= ResolveUrl("~/test.aspx") %>';


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


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

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜