473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Javascript to perform validations based on datagrid's hidden column values

40
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]..

Expand|Select|Wrap|Line Numbers
  1. function colorSelectedRow(chkB)
  2.         {
  3.             var prefix = getCrtlPrefix();
  4.  
  5.             var dataGridCtrlName = prefix + 'dg_Approve';
  6.  
  7.             var hiddenTxtBoxName = prefix + 'hdnTxtRowOrgColor';
  8.  
  9.             //// Highlight the row of Matched Grid based on the Checkbox selection
  10.             var IsChecked = chkB.checked;
  11.  
  12.             var navRoot,node,dgRowid = null,tBody,rwVal;
  13.  
  14.             //// Get the RowID of the row checked by the user
  15.             var rowID = chkB.parentElement.parentElement.cells[1].innerText;
  16.             alert(rowID);
  17.             //// Get the GroupID of the row checked by the user
  18.             var reconseqNo = chkB.parentElement.parentElement.cells[3].innerText;            alert(reconseqNo);
  19.  
  20.             if(document.all && document.getElementById)
  21.             {
  22.                 navRoot = document.getElementById(dataGridCtrlName);
  23.                 if(navRoot != null)
  24.                 {
  25.                     tBody = navRoot.childNodes[0];
  26.                if(IsChecked)
  27.                 {             
  28.                     //// Loop through all the childnodes of the Form body to Highlight the Row checked by user and also its Matching Row
  29.                     for(i=1;i<tBody.childNodes.length;i++)
  30.                     {
  31.                         node = tBody.childNodes[i];
  32.  
  33.                         //node.style.backgroundColor = "Khaki";
  34.                          if(node.cells[1].innerText == rowID)
  35.                         {   
  36.                                      document.getElementById(node.childNodes[0].childNodes[0].id).checked = true;
  37.                                     if(document.getElementById(hiddenTxtBoxName).value == '')
  38.                                           node.style.backgroundColor = "Khaki";
  39.                         }
  40.  
  41.                         if(node.cells[3].innerText == rowID)
  42.                         {   
  43.                                      document.getElementById(node.childNodes[0].childNodes[0].id).checked = true;
  44.                                     if(document.getElementById(hiddenTxtBoxName).value == '')
  45.                                           node.style.backgroundColor = "Khaki";
  46.                         }
  47.                     }
  48.                     }

Reply asap
Dec 10 '09 #1
2 2564
Dormilich
8,658 Expert Mod 8TB
and what exactly is not working? (what does the code do/not do?)
Dec 10 '09 #2
Blacky
40
When i click a checkbox in datagrid based on the reference column value of the row which is made visible false i need to automatically check the checbox of the matched rows and color it. It works fine if the reference column visibility is true. I want to perform the checking n coloring of matched rows based on the reference column which is made visible false at runtime
Dec 10 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Xerxes | last post by:
Hi, how can I pass the returned value from Javascript to PHP? I have: ------------------------------------------------------------------------ ------ if ( x>y) {
3
by: Ryan Riddell | last post by:
I am using the DataGrid control from 4guys (http://aspnet.4guysfromrolla.com/demos/RowHighlighter.aspx). I want to display 2 columns and allow editing. The only column I want the user to be able to...
4
by: Ian Cox | last post by:
I have a web form that contains a Datagrid. This grid has a number of columns, one of which contains a text box and validator for that text box. Everything works fine, when I press the "Save"...
0
by: Wyatt70 | last post by:
I'm attempting to implement a javascript popup calendar in a DataGrid. The calendar will be used to insert a date into a textbox. I keep getting a "System.NullReferenceException: Object reference...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
7
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the...
8
by: javascript | last post by:
I have a DataTable that I created in C# that looks like. Column1 - Column2 - Column3 1 - a - b 2 - c - d 3 - e - f Now if I want to get the value of column 3 with id 3 I simply need to do...
84
by: Patient Guy | last post by:
Which is the better approach in working with Javascript? 1. Server side processing: Web server gets form input, runs it into the Javascript module, and PHP collects the output for document prep....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.