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. Problem in Retrieving text of linkbutton using Java Script

Problem in Retrieving text of linkbutton using Java Script

Scheduled Pinned Locked Moved ASP.NET
javatoolshelptutorial
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.
  • A Offline
    A Offline
    ais07
    wrote on last edited by
    #1

    I want to retrieve text of link button. I am using following code but it is not working. var LblCountry =document.getElementById('" + lnktext.ClientID + "'); var ltext= LblCountry .value; when print this value using alertbox it shows as undefined Can anybody tell me how to retrieve link button value. Thanks

    A B 2 Replies Last reply
    0
    • A ais07

      I want to retrieve text of link button. I am using following code but it is not working. var LblCountry =document.getElementById('" + lnktext.ClientID + "'); var ltext= LblCountry .value; when print this value using alertbox it shows as undefined Can anybody tell me how to retrieve link button value. Thanks

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      enclose lnktext.ClientID into server tags..

      Abhishek Sur

      %>]]>

      A 1 Reply Last reply
      0
      • A Abhishek Sur

        enclose lnktext.ClientID into server tags..

        Abhishek Sur

        %>]]>

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

        Thanks for reply, But I am writing above code in seperate cs file.

        1 Reply Last reply
        0
        • A ais07

          I want to retrieve text of link button. I am using following code but it is not working. var LblCountry =document.getElementById('" + lnktext.ClientID + "'); var ltext= LblCountry .value; when print this value using alertbox it shows as undefined Can anybody tell me how to retrieve link button value. Thanks

          B Offline
          B Offline
          banker_kiran
          wrote on last edited by
          #4

          Hello, Using view source option of browser, Check that ClientID you are passing as argument and actual id are same.

          Kiran Banker

          A 1 Reply Last reply
          0
          • B banker_kiran

            Hello, Using view source option of browser, Check that ClientID you are passing as argument and actual id are same.

            Kiran Banker

            A Offline
            A Offline
            ais07
            wrote on last edited by
            #5

            Thanks for reply, I Checked Id's both are same.

            B 1 Reply Last reply
            0
            • A ais07

              Thanks for reply, I Checked Id's both are same.

              B Offline
              B Offline
              banker_kiran
              wrote on last edited by
              #6

              Try this document.getElementById('lnktext').value;

              Kiran Banker

              A 1 Reply Last reply
              0
              • B banker_kiran

                Try this document.getElementById('lnktext').value;

                Kiran Banker

                A Offline
                A Offline
                ais07
                wrote on last edited by
                #7

                It gives following error after using the code which you suggested. document.getElementById("lnktext") has no properties

                B 1 Reply Last reply
                0
                • A ais07

                  It gives following error after using the code which you suggested. document.getElementById("lnktext") has no properties

                  B Offline
                  B Offline
                  banker_kiran
                  wrote on last edited by
                  #8

                  var LblCountry =document.getElementById(lnktext.ClientID); alert(LblCountry); // It will alert as object. If it is not then try to copy same id from source and check. var ltext= LblCountry .value;

                  Kiran Banker

                  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