how to get selected value from dropdown list

Discussion in 'ASP .Net' started by Andy Sutorius, Mar 15, 2005.

  1. Hi,

    I created a web user control, a dropdown list of countries which binds to a
    select statement. I have placed that control in 2 different locations within
    the same form, but in different panels. When the page loads the control
    binds and displays perfectly. How do I get the selected value of each drop
    down?

    Thanks,

    Andy
    Andy Sutorius, Mar 15, 2005
    #1
    1. Advertising

  2. Andy Sutorius

    Brock Allen Guest

    Is DropDownList.SelectedValue what you're looking for?

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi,
    >
    > I created a web user control, a dropdown list of countries which binds
    > to a select statement. I have placed that control in 2 different
    > locations within the same form, but in different panels. When the page
    > loads the control binds and displays perfectly. How do I get the
    > selected value of each drop down?
    >
    > Thanks,
    >
    > Andy
    >
    Brock Allen, Mar 15, 2005
    #2
    1. Advertising

  3. Andy Sutorius

    Scott M. Guest

    lstDropDown.SelectedItem.Text or
    lstDropDown.SelectedItem.Value


    "Andy Sutorius" <> wrote in message
    news:ZpJZd.27117$...
    > Hi,
    >
    > I created a web user control, a dropdown list of countries which binds to
    > a
    > select statement. I have placed that control in 2 different locations
    > within
    > the same form, but in different panels. When the page loads the control
    > binds and displays perfectly. How do I get the selected value of each drop
    > down?
    >
    > Thanks,
    >
    > Andy
    >
    >
    Scott M., Mar 15, 2005
    #3
  4. It's a web user control and there are 2 of them. It's not that simple is it?


    "Scott M." <> wrote in message
    news:...
    > lstDropDown.SelectedItem.Text or
    > lstDropDown.SelectedItem.Value
    Andy Sutorius, Mar 15, 2005
    #4
  5. Andy Sutorius

    Scott M. Guest

    Why should it be any harder than this?


    "Andy Sutorius" <> wrote in message
    news:UVJZd.27209$...
    > It's a web user control and there are 2 of them. It's not that simple is
    > it?
    >
    >
    > "Scott M." <> wrote in message
    > news:...
    >> lstDropDown.SelectedItem.Text or
    >> lstDropDown.SelectedItem.Value

    >
    >
    Scott M., Mar 16, 2005
    #5
  6. Andy Sutorius

    faniccj

    Joined:
    Feb 11, 2011
    Messages:
    2
    Hello. i have a dropdown list, its asp.net control
    Code:
    <asp:DropDownList ID="searchdroplist" runat="server" 
            onselectedindexchanged="searchdroplist_SelectedIndexChanged">
            <asp:ListItem Value = "n" Selected="False">Search By Name</asp:ListItem>
            <asp:ListItem Value = "r">Search By Roll#</asp:ListItem>
        </asp:DropDownList>
    
    i have two lables and i want to show a lable mean lable.visible = true; on a specific list item selected.
    i m writing
    Code:
    if (searchdroplist.SelectedItem.Value == "n") {
    
                    namelbl.Visible = true;
    }
    
    but its not working for me. what is the mistake in this code?
    Last edited: Feb 11, 2011
    faniccj, Feb 11, 2011
    #6
  7. Andy Sutorius

    raouf2me

    Joined:
    Oct 29, 2012
    Messages:
    1
    You should set the property AutoPostBack a true
    raouf2me, Oct 29, 2012
    #7
    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. Scott Allen
    Replies:
    1
    Views:
    848
    Scott Allen
    Aug 25, 2004
  2. =?Utf-8?B?SklNLkgu?=

    Q: dropdown list, no selected value

    =?Utf-8?B?SklNLkgu?=, Apr 12, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    602
    Eliyahu Goldin
    Apr 12, 2005
  3. Guest
    Replies:
    6
    Views:
    10,111
    Rajesh
    Jan 8, 2006
  4. vishnu
    Replies:
    1
    Views:
    1,177
    Patrick.O.Ige
    Mar 25, 2006
  5. Replies:
    2
    Views:
    459
Loading...

Share This Page