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]..
Expand|Select|Wrap|Line Numbers
- 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
- var reconseqNo = chkB.parentElement.parentElement.cells[3].innerText; 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