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. how to get value from javascript on page load event

how to get value from javascript on page load event

Scheduled Pinned Locked Moved ASP.NET
helpcsharpjavascriptasp-nettutorial
8 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.
  • R Offline
    R Offline
    rahul net11
    wrote on last edited by
    #1

    Hi all, On asp.net page load i am calling a javascript function on window.onload function. In this function i am assigning some values to hidden field and when i am trying to read this value from page behind it return "".I am trying to access the hidden fiedl value on page load. string value= hiddentxt.value; but value returns "". Will anybody help me to solve the problem? Thanks

    People Laugh on me Because i am Different but i Laugh on them Because they all are same.

    C 1 Reply Last reply
    0
    • R rahul net11

      Hi all, On asp.net page load i am calling a javascript function on window.onload function. In this function i am assigning some values to hidden field and when i am trying to read this value from page behind it return "".I am trying to access the hidden fiedl value on page load. string value= hiddentxt.value; but value returns "". Will anybody help me to solve the problem? Thanks

      People Laugh on me Because i am Different but i Laugh on them Because they all are same.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Are you checking the value on postback, or on the first load of the page ?

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      R 1 Reply Last reply
      0
      • C Christian Graus

        Are you checking the value on postback, or on the first load of the page ?

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        R Offline
        R Offline
        rahul net11
        wrote on last edited by
        #3

        on the first page load.

        People Laugh on me Because i am Different but i Laugh on them Because they all are same.

        C 1 Reply Last reply
        0
        • R rahul net11

          on the first page load.

          People Laugh on me Because i am Different but i Laugh on them Because they all are same.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          You post here a lot to not know anything about how ASP.NET works. You should buy a good book and read it. When your page is rendered, it's because it's been delivered the HTML to render it., Which means that ASP.NET has already run the full page lifecycle, and generated the HTML. I don't see how else it could work, or why you'd think it would work differently. What you want to do is impossible. You want the onload event to fill a property, before your code has generated the page.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          R 1 Reply Last reply
          0
          • C Christian Graus

            You post here a lot to not know anything about how ASP.NET works. You should buy a good book and read it. When your page is rendered, it's because it's been delivered the HTML to render it., Which means that ASP.NET has already run the full page lifecycle, and generated the HTML. I don't see how else it could work, or why you'd think it would work differently. What you want to do is impossible. You want the onload event to fill a property, before your code has generated the page.

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            R Offline
            R Offline
            rahul net11
            wrote on last edited by
            #5

            When the asp.net page load then first it execute the code in .cs file and then it execute the javascript function. so i got "" in my hidden field value. n i know about asp.net page life cycle..

            People Laugh on me Because i am Different but i Laugh on them Because they all are same.

            C 1 Reply Last reply
            0
            • R rahul net11

              When the asp.net page load then first it execute the code in .cs file and then it execute the javascript function. so i got "" in my hidden field value. n i know about asp.net page life cycle..

              People Laugh on me Because i am Different but i Laugh on them Because they all are same.

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Yes, that's right. So, there's no way you can read it in your page load, for the first cycle, because, as you said, it gets read into the hidden field AFTER the page has run on the client side.

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              A R 2 Replies Last reply
              0
              • C Christian Graus

                Yes, that's right. So, there's no way you can read it in your page load, for the first cycle, because, as you said, it gets read into the hidden field AFTER the page has run on the client side.

                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                A Offline
                A Offline
                Arun Jacob
                wrote on last edited by
                #7

                Is it a popup?what u r trying to achieve?whats ur requirement?i mean r u trying to pass values from another page?tell me your requirement so that we can try to find out a solution...

                Arun Jacob http://codepronet.blogspot.com/

                1 Reply Last reply
                0
                • C Christian Graus

                  Yes, that's right. So, there's no way you can read it in your page load, for the first cycle, because, as you said, it gets read into the hidden field AFTER the page has run on the client side.

                  Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                  R Offline
                  R Offline
                  rahul net11
                  wrote on last edited by
                  #8

                  Ok thanks

                  People Laugh on me Because i am Different but i Laugh on them Because they all are same.

                  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