views:

198

answers:

4

hi,

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

+3  A: 
Response.Redirect("url")
TheTXI
+1  A: 

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>
Joel Coehoorn
+1  A: 

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
TStamper
A: 

server.Transfer("url",true) is much better to use because it hides the variables you want to pass if there are any.

Eric