Try with this :
<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).SelectedValue);
}
</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_SelectedIndexChanged">
<asp:ListItem value="">item0</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>
[quoted text, click to view] "Miguel Dias Moura" <internetNoSpam@27lamps.com> wrote in message
news:ejNuddQGEHA.1228@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> i wrote this script but it's not working as i expected. Can you tell me
what
> am i doing wrong?
>
> <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>
>
> Drop Down Menu:
>
> <asp:DropDownList AutoPostBack="true" ID="myselect" runat="server">
> <asp:ListItem value="www.bonsalunos.com">item1</asp:ListItem>
> <asp:ListItem value="www.sapo.pt">item2</asp:ListItem>
> <asp:ListItem value="www.google.com">item3</asp:ListItem>
> </asp:DropDownList>
>
> Thanks,
> Miguel
>
> "Bruno Sirianni" <brunosirianni@virgilio.it> wrote in message
> news:Z_kbc.7852$hc5.323837@news3.tin.it...
> > <asp:DropDownList /> have AutoPostBack property. If this property is set
> to
> > true it automatically when change the List value fire a
> SelectedIndexChanged
> > event on Page.
> >
> > In this method you can switch the DropDownList.SelectedValue and make a
> > Redirect where you want.
> >
> > Brun
> >
> >
> > "Miguel Dias Moura" <internetNoSpam@27lamps.com> wrote in message
> > news:OPPmCePGEHA.1368@TK2MSFTNGP11.phx.gbl...
> > > Hello,
> > >
> > > i have a drop down menu in ASP.net with 5 options. I want to redirect
to
> a
> > > certain page when a certain option is selected.
> > > I want to be redirected without having to click a button. Does anyone
> > knows
> > > how to make this?
> > >
> > > Thank You,
> > > Miguel
> > >
> > >
> >
> >
>
>