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. getting textbox text from client back to server side

getting textbox text from client back to server side

Scheduled Pinned Locked Moved ASP.NET
javascripthtmlcomsysadminhelp
5 Posts 3 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.
  • M Offline
    M Offline
    marky777
    wrote on last edited by
    #1

    Hi. I am trying to retrieve the text of a textbox from code behind after setting the text via javascript (JS) on the page itself. I do it like this via JS on a html radiobutton event:

    var provider = document.getElementById('<%=txtMailProvider.ID %>');
    provider.value = '@blah.com';

    I then try to get that text from the txtbox on a server button click event, in code like:

    string blah = txtMailProvider.Text;

    this bring back and empty string. Is there another, working, way to do this? Tried google, etc Any help would be great. Thanks M

    L M 2 Replies Last reply
    0
    • M marky777

      Hi. I am trying to retrieve the text of a textbox from code behind after setting the text via javascript (JS) on the page itself. I do it like this via JS on a html radiobutton event:

      var provider = document.getElementById('<%=txtMailProvider.ID %>');
      provider.value = '@blah.com';

      I then try to get that text from the txtbox on a server button click event, in code like:

      string blah = txtMailProvider.Text;

      this bring back and empty string. Is there another, working, way to do this? Tried google, etc Any help would be great. Thanks M

      L Offline
      L Offline
      lobbychmd
      wrote on last edited by
      #2

      is '@blah.com' still in the textbox after you press button?

      M 1 Reply Last reply
      0
      • M marky777

        Hi. I am trying to retrieve the text of a textbox from code behind after setting the text via javascript (JS) on the page itself. I do it like this via JS on a html radiobutton event:

        var provider = document.getElementById('<%=txtMailProvider.ID %>');
        provider.value = '@blah.com';

        I then try to get that text from the txtbox on a server button click event, in code like:

        string blah = txtMailProvider.Text;

        this bring back and empty string. Is there another, working, way to do this? Tried google, etc Any help would be great. Thanks M

        M Offline
        M Offline
        Mark Graham
        wrote on last edited by
        #3

        Firstly, check that EnableViewState hasn't been set to false on your text box. It's true by default so it will only be false if you or another programmer has added: EnableViewState="false"

        Mark Graham (MCP) // The Doodler blogging at: dotnet notepad

        M 1 Reply Last reply
        0
        • L lobbychmd

          is '@blah.com' still in the textbox after you press button?

          M Offline
          M Offline
          marky777
          wrote on last edited by
          #4

          yes it is, I see it set within the txtbox.

          1 Reply Last reply
          0
          • M Mark Graham

            Firstly, check that EnableViewState hasn't been set to false on your text box. It's true by default so it will only be false if you or another programmer has added: EnableViewState="false"

            Mark Graham (MCP) // The Doodler blogging at: dotnet notepad

            M Offline
            M Offline
            marky777
            wrote on last edited by
            #5

            Thanks guys for the help, I am using a hidden input field instead (last resort. :( ;P )

            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