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(objec t sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
private void DropDownList1_S electedIndexCha nged(object sender,
System.EventArg s e)
{
if (((DropDownList )sender).Select edValue != "")
Response.Redire ct(((DropDownLi st)sender).Sele ctedValue);
}
</script>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server" OnLoad="Page_Lo ad">
<asp:DropDownLi st id="DropDownLis t1" style="Z-INDEX: 101; LEFT: 184px;
POSITION: absolute; TOP: 184px"
runat="server" AutoPostBack="T rue"
OnSelectedIndex Changed="DropDo wnList1_Selecte dIndexChanged">
<asp:ListItem value="">select one...</asp:ListItem>
<asp:ListItem
value="http://www.bonsalunos. com">item1</asp:ListItem>
<asp:ListItem value="http://www.sapo.pt">it em2</asp:ListItem>
<asp:ListItem value="http://www.google.com" >item3</asp:ListItem>
</asp:DropDownLis t>
</form>
</body>
"Rajiv R" <ra************ ********@yahoo. com> wrote in message
news:e$******** ******@TK2MSFTN GP10.phx.gbl...
Hi Miguel,
Use the OnSelectedIndex Changed event of dropdownlist.
<asp:DropDownLi st AutoPostBack="t rue" ID="myselect" runat="server"
OnSelectedIndex Changed="mysele ct_Change"> <asp:ListItem value="www.goog le.com">Google</asp:ListItem>
<asp:ListItem value="www.yaho o.com">Yahoo</asp:ListItem>
<asp:ListItem
value="www.macr omedia.com">Mac romedia</asp:ListItem> </asp:DropDownLis t>
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******** ******@TK2MSFTN GP12.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:DropDownLi st AutoPostBack="t rue" ID="myselect" runat="server">
<asp:ListItem value="www.goog le.com">Google</asp:ListItem>
<asp:ListItem value="www.yaho o.com">Yahoo</asp:ListItem>
<asp:ListItem
value="www.macr omedia.com">Mac romedia</asp:ListItem> </asp:DropDownLis t>
Then i have this script:
<script runat="server">
Sub Page_Load(Sende r As Object, E As EventArgs)
if myselect.AutoPo stBack then
Response.Redire ct ("http://" &
myselect.items( myselect.Select edIndex).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