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. Get value from control

Get value from control

Scheduled Pinned Locked Moved ASP.NET
helpquestioncsharpjavascripthtml
4 Posts 2 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.
  • A Offline
    A Offline
    alimohammed
    wrote on last edited by
    #1

    Hi all, i have a aspx:text box, aspx:list box and an html button in my webform and when the user type something in the text box and click this value will be added to the list box, i have used javascript for this. now my problem is that, when i tried to take the items in the listbox in csharp code ( in submit button click), i dont get any value ( listbox.items.count shows zero). How can i get the values of this list box at server side code that i have populated at the client side? anyone please help me. Thanks in Advance... Regards, Ali

    A 1 Reply Last reply
    0
    • A alimohammed

      Hi all, i have a aspx:text box, aspx:list box and an html button in my webform and when the user type something in the text box and click this value will be added to the list box, i have used javascript for this. now my problem is that, when i tried to take the items in the listbox in csharp code ( in submit button click), i dont get any value ( listbox.items.count shows zero). How can i get the values of this list box at server side code that i have populated at the client side? anyone please help me. Thanks in Advance... Regards, Ali

      A Offline
      A Offline
      ayeleteric
      wrote on last edited by
      #2

      post your code how you add the items to the list

      Eric H.

      A 1 Reply Last reply
      0
      • A ayeleteric

        post your code how you add the items to the list

        Eric H.

        A Offline
        A Offline
        alimohammed
        wrote on last edited by
        #3

        function AddToList() { optn = new Option(); optn.text = document.forms[0].txtMonth.value; optn.value = optn.text; document.forms[0].listBox1.options.add(optn); } this is the code to add items to list box from textboc txtMonth.

        A 1 Reply Last reply
        0
        • A alimohammed

          function AddToList() { optn = new Option(); optn.text = document.forms[0].txtMonth.value; optn.value = optn.text; document.forms[0].listBox1.options.add(optn); } this is the code to add items to list box from textboc txtMonth.

          A Offline
          A Offline
          ayeleteric
          wrote on last edited by
          #4
          1. I try you code and it doesn't work. 2) Protected Sub Submit1_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick MsgBox(listBox1.SelectedItem.Text) End Sub I hope that I understood what you meant

          Eric H.

          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