Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Dropdown Selected Text

Dropdown Selected Text

Scheduled Pinned Locked Moved ASP.NET
questionhelp
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brendan Vogt
    wrote on last edited by
    #1

    Hi, How do I get the value of the text selected in a dropdown list? I can get the value of it like this: objOrder.Type = Int32.Parse(cboOrderTypes.SelectedValue); But how do I get the text that is displayed to the user in the dropdown into a variable? I hope someone can help?? Regards, ma se

    _ M 2 Replies Last reply
    0
    • B Brendan Vogt

      Hi, How do I get the value of the text selected in a dropdown list? I can get the value of it like this: objOrder.Type = Int32.Parse(cboOrderTypes.SelectedValue); But how do I get the text that is displayed to the user in the dropdown into a variable? I hope someone can help?? Regards, ma se

      _ Offline
      _ Offline
      _AK_
      wrote on last edited by
      #2

      to get the selected items text in a variable you can get like this: cboOrderTypes.SelectedItem.Text or if you want to get the value of the selected item then like this you can get: cboOrderTypes.SelectedItem.Value.ToString()

      Best Regards, Apurva Kaushal

      B S 2 Replies Last reply
      0
      • B Brendan Vogt

        Hi, How do I get the value of the text selected in a dropdown list? I can get the value of it like this: objOrder.Type = Int32.Parse(cboOrderTypes.SelectedValue); But how do I get the text that is displayed to the user in the dropdown into a variable? I hope someone can help?? Regards, ma se

        M Offline
        M Offline
        mnaveed
        wrote on last edited by
        #3

        use DropDownList1.SelectedItem.Text property for text.

        Nav.

        -- modified at 5:22 Monday 24th July, 2006

        B 1 Reply Last reply
        0
        • M mnaveed

          use DropDownList1.SelectedItem.Text property for text.

          Nav.

          -- modified at 5:22 Monday 24th July, 2006

          B Offline
          B Offline
          Brendan Vogt
          wrote on last edited by
          #4

          There is no selectedtext property.

          _ 1 Reply Last reply
          0
          • B Brendan Vogt

            There is no selectedtext property.

            _ Offline
            _ Offline
            _AK_
            wrote on last edited by
            #5

            you can get like SelectedItem.Text

            Best Regards, Apurva Kaushal

            B 1 Reply Last reply
            0
            • B Brendan Vogt

              Thanks this works just fine.

              _ Offline
              _ Offline
              _AK_
              wrote on last edited by
              #6

              always welcome :)

              Best Regards, Apurva Kaushal

              1 Reply Last reply
              0
              • _ _AK_

                to get the selected items text in a variable you can get like this: cboOrderTypes.SelectedItem.Text or if you want to get the value of the selected item then like this you can get: cboOrderTypes.SelectedItem.Value.ToString()

                Best Regards, Apurva Kaushal

                B Offline
                B Offline
                Brendan Vogt
                wrote on last edited by
                #7

                Thanks this works just fine.

                _ 1 Reply Last reply
                0
                • _ _AK_

                  you can get like SelectedItem.Text

                  Best Regards, Apurva Kaushal

                  B Offline
                  B Offline
                  Brendan Vogt
                  wrote on last edited by
                  #8

                  Thanks but I managed with it.

                  M 1 Reply Last reply
                  0
                  • B Brendan Vogt

                    Thanks but I managed with it.

                    M Offline
                    M Offline
                    mnaveed
                    wrote on last edited by
                    #9

                    sorry its SelectedItem.Text ....:-D

                    Nav.

                    B 1 Reply Last reply
                    0
                    • M mnaveed

                      sorry its SelectedItem.Text ....:-D

                      Nav.

                      B Offline
                      B Offline
                      Brendan Vogt
                      wrote on last edited by
                      #10

                      Yes I know. I also thought it would be something like SelectedText because there is a SelectedValue. But thanks for getting back anyways. Cheers.

                      1 Reply Last reply
                      0
                      • _ _AK_

                        to get the selected items text in a variable you can get like this: cboOrderTypes.SelectedItem.Text or if you want to get the value of the selected item then like this you can get: cboOrderTypes.SelectedItem.Value.ToString()

                        Best Regards, Apurva Kaushal

                        S Offline
                        S Offline
                        swissmiss86
                        wrote on last edited by
                        #11
                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups