Reading The Selected Value In DropDown List

Discussion in 'ASP .Net' started by Guest, Dec 14, 2005.

  1. Guest

    Guest Guest

    Do you have to use AutoPostBack to read the selected value in a dropdown
    list? I have an asp.net dropdown on a form. I'm filling it from a table
    when the page loads and want to read the value the user selected when they
    submit the entire form. But regardless of the value they select, I always
    get the first item in the list when I read it. I can get the values from
    the text boxes without a problem. But the dropdown list seems to work
    differently. What am I doing wrong? Thanks.

    Jerry
    Guest, Dec 14, 2005
    #1
    1. Advertising

  2. Jerry,

    No, you don't have to use AutoPostBack property. Rather check if you are
    using IsPostBack property in the PageLoad event.

    Eliyahu

    <> wrote in message
    news:...
    > Do you have to use AutoPostBack to read the selected value in a dropdown
    > list? I have an asp.net dropdown on a form. I'm filling it from a table
    > when the page loads and want to read the value the user selected when they
    > submit the entire form. But regardless of the value they select, I always
    > get the first item in the list when I read it. I can get the values from
    > the text boxes without a problem. But the dropdown list seems to work
    > differently. What am I doing wrong? Thanks.
    >
    > Jerry
    >
    >
    Eliyahu Goldin, Dec 14, 2005
    #2
    1. Advertising

  3. Jerry,

    Please post your code. I'm dealing with a similar issue.

    Thanks,
    --
    Joe

    VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


    "" wrote:

    > Do you have to use AutoPostBack to read the selected value in a dropdown
    > list? I have an asp.net dropdown on a form. I'm filling it from a table
    > when the page loads and want to read the value the user selected when they
    > submit the entire form. But regardless of the value they select, I always
    > get the first item in the list when I read it. I can get the values from
    > the text boxes without a problem. But the dropdown list seems to work
    > differently. What am I doing wrong? Thanks.
    >
    > Jerry
    >
    >
    >
    =?Utf-8?B?Sm9l?=, Dec 14, 2005
    #3
  4. Guest

    Morgan Guest

    Make sure you are not repopulating the drop down list on postback. This will
    force you to get the first item in the list.

    <> wrote in message
    news:...
    > Do you have to use AutoPostBack to read the selected value in a dropdown
    > list? I have an asp.net dropdown on a form. I'm filling it from a table
    > when the page loads and want to read the value the user selected when they
    > submit the entire form. But regardless of the value they select, I always
    > get the first item in the list when I read it. I can get the values from
    > the text boxes without a problem. But the dropdown list seems to work
    > differently. What am I doing wrong? Thanks.
    >
    > Jerry
    >
    >
    Morgan, Dec 14, 2005
    #4
  5. Guest

    Guest Guest

    That was the issue... I had entered the call below my IsPostBack block...

    Thanks!


    "Morgan" <> wrote in message
    news:u$...
    > Make sure you are not repopulating the drop down list on postback. This

    will
    > force you to get the first item in the list.
    >
    > <> wrote in message
    > news:...
    > > Do you have to use AutoPostBack to read the selected value in a dropdown
    > > list? I have an asp.net dropdown on a form. I'm filling it from a

    table
    > > when the page loads and want to read the value the user selected when

    they
    > > submit the entire form. But regardless of the value they select, I

    always
    > > get the first item in the list when I read it. I can get the values

    from
    > > the text boxes without a problem. But the dropdown list seems to work
    > > differently. What am I doing wrong? Thanks.
    > >
    > > Jerry
    > >
    > >

    >
    >
    Guest, Dec 14, 2005
    #5
  6. Guest

    tdavisjr Guest

    I had an issue today similar to this; but my issue was the the value
    property for each of the list items was not unique. To keep the
    selection after postback the value property MUST be unique.
    tdavisjr, Dec 14, 2005
    #6
  7. Guest

    Rajesh Guest

    Hey
    Why dont u make use of the ViewState of the control property to reset the
    selected value

    Rajesh

    "tdavisjr" <> wrote in message
    news:...
    >I had an issue today similar to this; but my issue was the the value
    > property for each of the list items was not unique. To keep the
    > selection after postback the value property MUST be unique.
    >
    Rajesh, Jan 8, 2006
    #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:
    862
    Scott Allen
    Aug 25, 2004
  2. Andy Sutorius

    how to get selected value from dropdown list

    Andy Sutorius, Mar 15, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    82,365
    raouf2me
    Oct 29, 2012
  3. =?Utf-8?B?SklNLkgu?=

    Q: dropdown list, no selected value

    =?Utf-8?B?SklNLkgu?=, Apr 12, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    617
    Eliyahu Goldin
    Apr 12, 2005
  4. vishnu
    Replies:
    1
    Views:
    1,203
    Patrick.O.Ige
    Mar 25, 2006
  5. Replies:
    2
    Views:
    481
Loading...

Share This Page