I have asp.net button and on it's button click I am redirecting it using
Response.Redirect ("SomeURL.aspx");
I am not passing anything to SomeURL.aspx. Can this be achieved without a roundtrip to the server?
You could use an html anchor tag. This is the simplest approach and probably the best since anchors are the proper control to allow navigation.
<a href="SomeUrl.aspx">My link</a>
If you still want to use the asp.net button you could do something like this
<asp:Button runat="server" ID="myButton"
OnClientClick="window.location.href='SomeURL.aspx'; return false;"
Text="Submit"></asp:Button>
You can try with this code - based on Javascript Navigate
window.navigate("SomeURL.aspx");
Sample
<input type="button" value="Navigate to SomeURL" onclick="funcNavigate();">
<script language="JavaScript">
function funcNavigate() {
window.navigate("SomeURL.aspx");
}
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With