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. Accessing Textbox Control in Gridview from Javascript.

Accessing Textbox Control in Gridview from Javascript.

Scheduled Pinned Locked Moved ASP.NET
javascripthtmlhelp
5 Posts 4 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.
  • C Offline
    C Offline
    cheguri
    wrote on last edited by
    #1

    Dear, I have created html textboxes in GridViewDataRow. I created html textboxes dynamically. I have given the IDs dynamically. By default the textboxes should be disabled. When I click linkbutton outside the gridview with onClientClick event, a javascript function should be called and then all the textboxes in gridview should be enabled. Please help me in implementing this. Help would be appreciated. Regards, Dileep.

    B J A 3 Replies Last reply
    0
    • C cheguri

      Dear, I have created html textboxes in GridViewDataRow. I created html textboxes dynamically. I have given the IDs dynamically. By default the textboxes should be disabled. When I click linkbutton outside the gridview with onClientClick event, a javascript function should be called and then all the textboxes in gridview should be enabled. Please help me in implementing this. Help would be appreciated. Regards, Dileep.

      B Offline
      B Offline
      Brij
      wrote on last edited by
      #2

      Why are you creating textbox dynamically. Its better if you it to be always there, show and hide according to your requirement in rowdatabpound event of gridview.Store the Ids in some hidden field and in JS function, itereate through all the IDs and make them enable.

      Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators

      1 Reply Last reply
      0
      • C cheguri

        Dear, I have created html textboxes in GridViewDataRow. I created html textboxes dynamically. I have given the IDs dynamically. By default the textboxes should be disabled. When I click linkbutton outside the gridview with onClientClick event, a javascript function should be called and then all the textboxes in gridview should be enabled. Please help me in implementing this. Help would be appreciated. Regards, Dileep.

        J Offline
        J Offline
        Jamil Hallal
        wrote on last edited by
        #3

        Hi, Please try the following: <script language="javascript" type="text/javascript"> function EnableTextBoxes() { var gv = document.getElementById('GridViewID'); var objs = gv.getElementsByTagName('input'); var i=0; for (i = 0; i < objs.length; i++) { if (objs[i].style.display == 'none') { objs[i].style.display = 'block'; } } } </script>

        Regards, Jamil

        C 1 Reply Last reply
        0
        • J Jamil Hallal

          Hi, Please try the following: <script language="javascript" type="text/javascript"> function EnableTextBoxes() { var gv = document.getElementById('GridViewID'); var objs = gv.getElementsByTagName('input'); var i=0; for (i = 0; i < objs.length; i++) { if (objs[i].style.display == 'none') { objs[i].style.display = 'block'; } } } </script>

          Regards, Jamil

          C Offline
          C Offline
          cheguri
          wrote on last edited by
          #4

          Dear Jamil, Thanks for your reply. But its still not working. No changes occured, still the textboxes are disabled only. Please dude, since last 2 days I am struggling for this. Please do help me. Regards, Dileep

          1 Reply Last reply
          0
          • C cheguri

            Dear, I have created html textboxes in GridViewDataRow. I created html textboxes dynamically. I have given the IDs dynamically. By default the textboxes should be disabled. When I click linkbutton outside the gridview with onClientClick event, a javascript function should be called and then all the textboxes in gridview should be enabled. Please help me in implementing this. Help would be appreciated. Regards, Dileep.

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

            Iterate through the grid view from javascript, find the textbox either by tagname or by Id and enable it like this, txtBox.disabled=false; Let me know if it works.

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

            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