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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. DropDownList with no postback

DropDownList with no postback

Scheduled Pinned Locked Moved ASP.NET
javascripthelp
6 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.
  • E Offline
    E Offline
    e32magic
    wrote on last edited by
    #1

    hello. need some help. i'm trying to populate a textbox with the value of the selected dropdown. so, when a user selects an item from the dropdown the textbox would populate with that value. the catch is no postback. is there like a javascript for this. thanks in advance. :) e32

    V M 2 Replies Last reply
    0
    • E e32magic

      hello. need some help. i'm trying to populate a textbox with the value of the selected dropdown. so, when a user selects an item from the dropdown the textbox would populate with that value. the catch is no postback. is there like a javascript for this. thanks in advance. :) e32

      V Offline
      V Offline
      VaibhavJ
      wrote on last edited by
      #2

      Hi, Add this code inside ur Page_Load DropDownList1.Attributes.Add("onchange","javascript:getValue();"); This is the javascript code. function getValue() { var textBox1 = document.getElementById("TextBox1"); textBox1.value = document.getElementById("DropDownList1").value; } I hope this solves ur problem... Thank u...

      E 1 Reply Last reply
      0
      • E e32magic

        hello. need some help. i'm trying to populate a textbox with the value of the selected dropdown. so, when a user selects an item from the dropdown the textbox would populate with that value. the catch is no postback. is there like a javascript for this. thanks in advance. :) e32

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

        HOw about adding something like: TextBox1.Text = DropDownList1.SelectedItem.Value In the Selected IndexChanged property of the DropDownList, making sure that postback is switched on for the DDL ? munklefish

        R E 2 Replies Last reply
        0
        • M munklefish

          HOw about adding something like: TextBox1.Text = DropDownList1.SelectedItem.Value In the Selected IndexChanged property of the DropDownList, making sure that postback is switched on for the DDL ? munklefish

          R Offline
          R Offline
          rah_sin
          wrote on last edited by
          #4

          try DropDownList1.AutoPostBack=true; in page_load. rahul

          1 Reply Last reply
          0
          • V VaibhavJ

            Hi, Add this code inside ur Page_Load DropDownList1.Attributes.Add("onchange","javascript:getValue();"); This is the javascript code. function getValue() { var textBox1 = document.getElementById("TextBox1"); textBox1.value = document.getElementById("DropDownList1").value; } I hope this solves ur problem... Thank u...

            E Offline
            E Offline
            e32magic
            wrote on last edited by
            #5

            thanks for the help. really appreciate... i will try it out... :)

            1 Reply Last reply
            0
            • M munklefish

              HOw about adding something like: TextBox1.Text = DropDownList1.SelectedItem.Value In the Selected IndexChanged property of the DropDownList, making sure that postback is switched on for the DDL ? munklefish

              E Offline
              E Offline
              e32magic
              wrote on last edited by
              #6

              thanks for the suggestion... but i wanted a solution that involved no postback... thanks...

              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