Reputation: 7201
I am working with ASP.NET
I have a DropDownList item and in there i have hyperlinks as values. What event must i use in my code behind to redirect the user to that URL when he selects the "eRate" item?
My code
<asp:DropDownList ID="dropSelect" runat="server" Width="126px">
<asp:ListItem>Please select</asp:ListItem>
<asp:ListItem Value="http://www.erate.co.za">eRate</asp:ListItem>
</asp:DropDownList>
thanks in advance!!
Upvotes: 0
Views: 335
Reputation: 19138
add a onselectedindexchanged to the dropdown like this
OnSelectedIndexChanged="dropSelect_OnSelectedIndexChanged"
then codebehind you can do like this.
protected void dropSelect_OnSelectedIndexChanged(object sender, EventArgs e)
{
Response.Redirect(dropSelect.SelectedValue);
}
you can do some extra null check and all that but this is the basic idea you can use
Upvotes: 3