There was already a response in :
03/04/2004 -- Re: Jump Menu (DropDown Menu) in ASP.net. Can someone help
me out?
<script runat=server language=C#>
private void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
private void DropDownList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
if (((DropDownList)sender).SelectedValue != "")
Response.Redirect(((DropDownList)sender).SelectedV alue);
}
</script>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server" OnLoad="Page_Load">
<asp:DropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 184px;
POSITION: absolute; TOP: 184px"
runat="server" AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedInde xChanged">
<asp:ListItem value="">select one...</asp:ListItem>
<asp:ListItem
value="http://www.bonsalunos.com">item1</asp:ListItem>
<asp:ListItem value="http://www.sapo.pt">item2</asp:ListItem>
<asp:ListItem value="http://www.google.com">item3</asp:ListItem>
</asp:DropDownList>
</form>
</body>
"Rajiv R" <ra********************@yahoo.com> wrote in message
news:e$**************@TK2MSFTNGP10.phx.gbl...
Hi Miguel,
Use the OnSelectedIndexChanged event of dropdownlist.
<asp:DropDownList AutoPostBack="true" ID="myselect" runat="server"
OnSelectedIndexChanged="myselect_Change"> <asp:ListItem value="www.google.com">Google</asp:ListItem>
<asp:ListItem value="www.yahoo.com">Yahoo</asp:ListItem>
<asp:ListItem
value="www.macromedia.com">Macromedia</asp:ListItem> </asp:DropDownList>
then you can write the handler as
void myselect_Change(Object sender, EventArgs e) {
}
--
Cheers!
Rajiv. R
Rajspace.Org
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:#x**************@TK2MSFTNGP12.phx.gbl... Hello,
I have a Drop Down List with 3 options. I want to redirect to a new page
when an options is selected. I don't want to use a button. The
redirection should be fired when the option is selected.
I have an ASP.net / VB page with a Drop Down List named "my select" as
follows:
<asp:DropDownList AutoPostBack="true" ID="myselect" runat="server">
<asp:ListItem value="www.google.com">Google</asp:ListItem>
<asp:ListItem value="www.yahoo.com">Yahoo</asp:ListItem>
<asp:ListItem
value="www.macromedia.com">Macromedia</asp:ListItem> </asp:DropDownList>
Then i have this script:
<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
if myselect.AutoPostBack then
Response.Redirect ("http://" &
myselect.items(myselect.SelectedIndex).Value)
end if
End Sub
</script>
I looked in the .net and tryied several options but until now i wasn't
able to make it work
This seems really simple. I don't know what is going on and i need to
deliver this as soon as possible. Can you help me?
Thank You,
Miguel