How to handle hidden datagrid column validations

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Blacky
    New Member
    • Jan 2009
    • 40

    How to handle hidden datagrid column validations

    Hi,

    I am using c# asp.net application.I have datagrid which binds column dynamically and i make certain columns say visibility to false in my itemdatabound event EMPID AS E.ITEM.CELLS[3].VISIBLE = FALSE.Now i want to perform validations based on this value in cell[3] using javascript...

    By clicking on one rows checkbox in datagrid, i need to color all other rows which has the same value in the hidden column EMP... IE cells[3]..

    Code:
    function colorSelectedRow(chkB)
    {
             
      var prefix = getCrtlPrefix();
      var dataGridCtrlName = prefix + 'dg_Approve';
      var hiddenTxtBoxName = prefix + 'hdnTxtRowOrgColor';
                
      //// Highlight the row of Matched Grid based on the Checkbox selection
      var IsChecked = chkB.checked;
                
      var navRoot,node,dgRowid = null,tBody,rwVal;
                 
      //// Get the RowID of the row checked by the user
      var rowID = chkB.parentElement.parentElement.cells[1].innerText;
      alert(rowID);
      //// Get the GroupID of the row checked by the user
      [B]var reconseqNo = chkB.parentElement.parentElement.cells[3].innerText;[/B]
      alert(reconseqNo);
                
      if(document.all && document.getElementById)
      {
        navRoot = document.getElementById(dataGridCtrlName);
        if(navRoot != null)
        {
          tBody = navRoot.childNodes[0];
          if(IsChecked)
          {             
            //// Loop through all the childnodes of the Form body to Highlight the Row checked by user and also its Matching Row
            for(i=1;i<tBody.childNodes.length;i++)
            {
              node = tBody.childNodes[i];
              //node.style.backgroundColor = "Khaki";
              if(node.cells[1].innerText == rowID)
              {   
                 document.getElementById(node.childNodes[0].childNodes[0].id).checked = true;
                 if(document.getElementById(hiddenTxtBoxName).value == '')
                   node.style.backgroundColor = "Khaki";
              }
                            
              if(node.cells[3].innerText == rowID)
              {   
                 document.getElementById(node.childNodes[0].childNodes[0].id).checked = true;
                 if(document.getElementById(hiddenTxtBoxName).value == '')
                   node.style.backgroundColor = "Khaki";
              }                  
            }
          }
        }
      }
    }

    Reply asap
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    What seems to be the problem?

    I formatted the JavaScript that you've posted so that it is easier to read (indented things etc). I discovered that you were missing 3 close braces ("}"). I'm assuming that you just copy/pasted wrong.

    You have highlighted line 17...
    Is there something wrong with this line?

    -Frinny

    Comment

    Working...