get url

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please,
I have dropdownlist on my webform. I would like to get web page on certain url adress automaticly when I select an item in dropdown list. I have put AutoPostBack property of dropdownlist to true. I only know how to reach some web page using hyperlink.NavigateUrl . Is there any way to get url adress by using normal buttons or, like in this case, list controls, instead using hyperlink ?
Thank you
 
You need to catch the SelectedIndexChanged event and then redirect to the
selected page. Is this what you meant?

Private Sub DropDownList1_SelectedIndexChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles DropDownList1.SelectedIndexChanged
Response.Redirect(DropDownList1.SelectedItem.Value)
End Sub

<asp:DropDownList id="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem>---Choose---</asp:ListItem>
<asp:ListItem Value="http://www.microsoft.com">Microsoft</asp:ListItem>
<asp:ListItem Value="http://www.google.com">Google</asp:ListItem>
<asp:ListItem Value="http://www.neowin.net">Neowin</asp:ListItem>
</asp:DropDownList>

Ken
MVP [ASP.NET]
 
Back
Top