Reading dropdown values in ASP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Walke

    Reading dropdown values in ASP

    Hi all,

    I have an ASP application where I need to not only read the selected item
    from a combo box on a web page but also all the options in the combo box.
    Can someone point me in the right direction.

    I can obviously use request.queryst ring() or request.form() to get the
    selected value but not sure about how to get the options.

    TIA
    Martin


  • Bob Barrows [MVP]

    #2
    Re: Reading dropdown values in ASP

    Martin Walke wrote:
    Hi all,
    >
    I have an ASP application where I need to not only read the selected
    item from a combo box on a web page but also all the options in the
    combo box. Can someone point me in the right direction.
    >
    I can obviously use request.queryst ring() or request.form() to get the
    selected value but not sure about how to get the options.
    >
    Obviously, you have to store the values somewhere that is accessible to the
    code running on the web server. Possibilities inclued a database, a text
    file, an xml file, a session variable, an application variable, or some
    combination of the above.

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Comment

    • Bob Barrows [MVP]

      #3
      Re: Reading dropdown values in ASP

      Martin Walke wrote:
      Hi all,
      >
      I have an ASP application where I need to not only read the selected
      item from a combo box on a web page but also all the options in the
      combo box. Can someone point me in the right direction.
      >
      I can obviously use request.queryst ring() or request.form() to get the
      selected value but not sure about how to get the options.
      >
      Oh! One possibility i neglected to mention was to use a hidden field in
      the form to store the option values, making them part of the Request.

      --
      Microsoft MVP -- ASP/ASP.NET
      Please reply to the newsgroup. The email account listed in my From
      header is my spam trap, so I don't check it very often. You will get a
      quicker response by posting to the newsgroup.


      Comment

      • Tim Slattery

        #4
        Re: Reading dropdown values in ASP

        "Martin Walke" <martin.walke_n o_spam@vega_dot _co_dot_ukwrote :
        >Hi all,
        >
        >I have an ASP application where I need to not only read the selected item
        >from a combo box on a web page but also all the options in the combo box.
        >Can someone point me in the right direction.
        >
        >I can obviously use request.queryst ring() or request.form() to get the
        >selected value but not sure about how to get the options.
        You can't. When the form is submitted, one value is transmitted for a
        select group: the "value" attribute of the selected option. Nothing
        else is sent.

        If you want to know the other options in the select group, you'll have
        to do it another way: store them in a database, in the session object,
        something like that. And bear in mind, that what's transmitted for the
        selected option is not what the user sees, it's the "value" attribute.

        --
        Tim Slattery
        MS MVP(DTS)
        Slattery_T@bls. gov

        Comment

        • Martin Walke

          #5
          Re: Reading dropdown values in ASP

          Thanks Tim. It was as I assumed. As per my comment to Bob, I'll use a hidden
          field populated by my validate routine.

          Martin


          "Tim Slattery" <Slattery_T@bls .govwrote in message
          news:u4en03t05p u582mtenfbq7bo5 u0no3sh24@4ax.c om...
          "Martin Walke" <martin.walke_n o_spam@vega_dot _co_dot_ukwrote :
          >
          >>Hi all,
          >>
          >>I have an ASP application where I need to not only read the selected item
          >>from a combo box on a web page but also all the options in the combo box.
          >>Can someone point me in the right direction.
          >>
          >>I can obviously use request.queryst ring() or request.form() to get the
          >>selected value but not sure about how to get the options.
          >
          You can't. When the form is submitted, one value is transmitted for a
          select group: the "value" attribute of the selected option. Nothing
          else is sent.
          >
          If you want to know the other options in the select group, you'll have
          to do it another way: store them in a database, in the session object,
          something like that. And bear in mind, that what's transmitted for the
          selected option is not what the user sees, it's the "value" attribute.
          >
          --
          Tim Slattery
          MS MVP(DTS)
          Slattery_T@bls. gov
          http://members.cox.net/slatteryt

          Comment

          • Martin Walke

            #6
            Re: Reading dropdown values in ASP

            Thanks Bob.

            My line of thinking was to a hidden field anyway.

            I just wondered, although couldn't find any reference to it, whether the
            srever could access the data in some sneaky way. Obviously, if I'd thought
            it through, that client side data doesn't get transmitted in the Request.

            Martin

            "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcomwrote in message
            news:eb52p4fcHH A.4772@TK2MSFTN GP05.phx.gbl...
            Martin Walke wrote:
            >Hi all,
            >>
            >I have an ASP application where I need to not only read the selected
            >item from a combo box on a web page but also all the options in the
            >combo box. Can someone point me in the right direction.
            >>
            >I can obviously use request.queryst ring() or request.form() to get the
            >selected value but not sure about how to get the options.
            >>
            Oh! One possibility i neglected to mention was to use a hidden field in
            the form to store the option values, making them part of the Request.
            >
            --
            Microsoft MVP -- ASP/ASP.NET
            Please reply to the newsgroup. The email account listed in my From
            header is my spam trap, so I don't check it very often. You will get a
            quicker response by posting to the newsgroup.
            >
            >

            Comment

            Working...