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. string value

string value

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-nettutorial
3 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.
  • N Offline
    N Offline
    netJP12L
    wrote on last edited by
    #1

    Hi, I want to store a returned value to a hiddenField1 asp.net variable in javascript. I tried declaring the hidden field gave name but my when i tried to display the value of hiddenfield1 variable in my asp.net onclick button event it's return empty. Is it even possible to initialize asp.net variable in javascript. can somebody tell me how to do. Thanks function File1_onclick() { var HiddenField1; alert(document.getElementById("File1").value); HiddenField1=document.getElementById("File1").value; }

    M A 2 Replies Last reply
    0
    • N netJP12L

      Hi, I want to store a returned value to a hiddenField1 asp.net variable in javascript. I tried declaring the hidden field gave name but my when i tried to display the value of hiddenfield1 variable in my asp.net onclick button event it's return empty. Is it even possible to initialize asp.net variable in javascript. can somebody tell me how to do. Thanks function File1_onclick() { var HiddenField1; alert(document.getElementById("File1").value); HiddenField1=document.getElementById("File1").value; }

      M Offline
      M Offline
      Mack Ait Aoudia
      wrote on last edited by
      #2

      I don't understand what you are trying to do. So, I'll give an exemple: Declare the hidden like that: Protected WithEvents hiddenWo As System.Web.UI.HtmlControls.HtmlInputHidden you this html in client side: In server side you could just use it like that: If hiddenWo.Value <> "" Then 'do something else 'do something end if In client side: document.getElementById("hiddenWo").value+=2 + "|"; Hope it helps!!

      Just Relax And Keep It Simple.

      1 Reply Last reply
      0
      • N netJP12L

        Hi, I want to store a returned value to a hiddenField1 asp.net variable in javascript. I tried declaring the hidden field gave name but my when i tried to display the value of hiddenfield1 variable in my asp.net onclick button event it's return empty. Is it even possible to initialize asp.net variable in javascript. can somebody tell me how to do. Thanks function File1_onclick() { var HiddenField1; alert(document.getElementById("File1").value); HiddenField1=document.getElementById("File1").value; }

        A Offline
        A Offline
        Artem Kustikov
        wrote on last edited by
        #3

        Try to use OnChange event handler instead of OnClick

        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