Redirect page to another URL (vb.net) : ReDirect « Response « ASP.Net






Redirect page to another URL (vb.net)

<%@ Page Language="VB" %>
<script language="vb" runat="server">
   Sub Page_Load(Source As Object, E as EventArgs)
     If Not IsPostBack Then
       MyButton.Text = "OK"
       MyDropDownList.Items.Add("http://www.java2s.com")
       MyDropDownList.Items.Add("http://www.java2s.com")
       MyDropDownList.Items.Add("http://www.java2s.com")
     End If
   End Sub

   Public Sub Click (ByVal sender As Object, ByVal e As System.EventArgs)
     Response.Redirect(MyDropDownList.SelectedItem.Text)
   End Sub
</script>
<html>
  <body>
    <form id="WebForm1" method="post" runat="server">
      <asp:DropDownList id=MyDropDownList runat="server"/>
      <asp:button id=MyButton runat="server" OnClick="Click" Text=""/>
    </form>
  </body>
</html>

           
       








Related examples in the same category

1.Redirect a URL (C#)