Pass value from Grid View to Javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yogendrakumar
    New Member
    • May 2007
    • 1

    Pass value from Grid View to Javascript

    sir,
    how can i pass the value of checkbox(in Grid view) to the another form(textbox) in java script.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    To pass to another form:
    [code=javascript]//get the textbox
    var txtbox = document.getEle mentById("txtBo xID");
    // get the checkbox value
    var chkbox = document.getEle mentById("chkbo xID");
    var val = chkbox.checked // or possibly value depending on what the OP meant
    // set textbox
    txtbox.value = val;[/code]

    Comment

    • kunal pawar
      Contributor
      • Oct 2007
      • 297

      #3
      I think in gridview there are more than one check box

      So u have to take collection of check box and in loop u have to check which check box is selected

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by kunal pawar
        I think in gridview there are more than one check box

        So u have to take collection of check box and in loop u have to check which check box is selected
        Thanks. That's probably correct. Without code, I could only guess how the checkbox could be accessed based on the information given by the OP.

        Comment

        Working...