Reputation:
In asp.net 3.5 using vb i would like to go to another page in my application when the user clicks a button. what is the command for doing this?
Thank you
Upvotes: 0
Views: 620
Reputation: 8088
server.Transfer("url",true) is much better to use because it hides the variables you want to pass if there are any.
Upvotes: 0
Reputation: 30384
Here is an example of how that would happen
Public Sub Click (ByVal sender As Object, ByVal e As System.EventArgs)
Response.Redirect(SelectedItem.Text)
End Sub
Upvotes: 1
Reputation: 416149
As TheTXI mentioned, Response.Redirect
will work just fine.
However, your button click code won't run until late in the page life cycle. Your server may have to do quite a bit of extra or unnecessary work first. If this is the only thing you are doing, just wrap the button in an anchor tag:
<a href="url"><asp:button .../></a>
Upvotes: 1