472,976 Members | 1,224 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,976 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 2528
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
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.