Jump Menu (DropDown Menu) in ASP.net. Can someone help me out?

Discussion in 'ASP .Net' started by Miguel Dias Moura, Apr 2, 2004.

  1. 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
     
    Miguel Dias Moura, Apr 2, 2004
    #1
    1. Advertising

  2. <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" <> wrote in message
    news:...
    > 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
    >
    >
     
    Bruno Sirianni, Apr 2, 2004
    #2
    1. Advertising

  3. 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" <> wrote in message
    news:Z_kbc.7852$...
    > <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" <> wrote in message
    > news:...
    > > 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
    > >
    > >

    >
    >
     
    Miguel Dias Moura, Apr 3, 2004
    #3
  4. 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>





    "Miguel Dias Moura" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:Z_kbc.7852$...
    > > <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" <> wrote in message
    > > news:...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >
     
    Bruno Sirianni, Apr 3, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike
    Replies:
    1
    Views:
    815
  2. Brent White
    Replies:
    2
    Views:
    537
    Peter Bromberg [C# MVP]
    Jan 30, 2008
  3. emekadavid

    can someone help me out

    emekadavid, May 20, 2008, in forum: Java
    Replies:
    0
    Views:
    308
    emekadavid
    May 20, 2008
  4. FluxForums

    Dropdown Jump Menu

    FluxForums, Feb 22, 2004, in forum: Javascript
    Replies:
    0
    Views:
    152
    FluxForums
    Feb 22, 2004
  5. Eadwine Rose
    Replies:
    2
    Views:
    216
    Eadwine Rose
    Oct 15, 2006
Loading...

Share This Page