473,387 Members | 1,520 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,387 software developers and data experts.

How to handle hidden datagrid column validations

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.  
  4.   var prefix = getCrtlPrefix();
  5.   var dataGridCtrlName = prefix + 'dg_Approve';
  6.   var hiddenTxtBoxName = prefix + 'hdnTxtRowOrgColor';
  7.  
  8.   //// Highlight the row of Matched Grid based on the Checkbox selection
  9.   var IsChecked = chkB.checked;
  10.  
  11.   var navRoot,node,dgRowid = null,tBody,rwVal;
  12.  
  13.   //// Get the RowID of the row checked by the user
  14.   var rowID = chkB.parentElement.parentElement.cells[1].innerText;
  15.   alert(rowID);
  16.   //// Get the GroupID of the row checked by the user
  17.   var reconseqNo = chkB.parentElement.parentElement.cells[3].innerText;
  18.   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.           //node.style.backgroundColor = "Khaki";
  33.           if(node.cells[1].innerText == rowID)
  34.           {   
  35.              document.getElementById(node.childNodes[0].childNodes[0].id).checked = true;
  36.              if(document.getElementById(hiddenTxtBoxName).value == '')
  37.                node.style.backgroundColor = "Khaki";
  38.           }
  39.  
  40.           if(node.cells[3].innerText == rowID)
  41.           {   
  42.              document.getElementById(node.childNodes[0].childNodes[0].id).checked = true;
  43.              if(document.getElementById(hiddenTxtBoxName).value == '')
  44.                node.style.backgroundColor = "Khaki";
  45.           }                  
  46.         }
  47.       }
  48.     }
  49.   }
  50. }

Reply asap
Dec 10 '09 #1
1 2082
Frinavale
9,735 Expert Mod 8TB
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
Dec 10 '09 #2

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

Similar topics

4
by: chris | last post by:
Hello group, The datagrid I use needs to add a hidden column on demand (only on certain conditions). The sequence of events would be as below: 1) get the dataset(ds) and bind the datagrid(dg) with...
1
by: Mark | last post by:
Hi, I have a datagrid with a column for the Edit, Update, Cancel links. That worked fine. Above the datagrid I then added a textbox, required field validator and button so I could use that to...
3
by: me | last post by:
I have a column in my datagrid showing the unique identifier of the rows from the database. I want to hide it but if I switch "visible" off in visual studios property builder for datagrids then...
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"...
2
by: Not Me | last post by:
Hi, In a datagrid's itemcommand method, I can use DataGridCommandEventArgs/item/cells/text to bring up a specific field from a row that was accessed. However, I wish to lookup data from that...
4
by: Nicky | last post by:
hi, all I got another quesiton, in my DataGrid control, I want to have a hidden column which will contian an ID value, I don't want to display this ID value to user, but I need it when user click...
0
by: Waran | last post by:
Hi, In a datagrid I am displaying 2 columns. One is a Hyperlink Colum and the other is a Button Column. The values for the hyperlink columns are fetched from the database and its a url. When I...
4
by: Localbar | last post by:
hi all, If I have a datagrid, actually has 5 column. but I would like in run time hidden last column. The reason is the form also have combobox for filter datagrid row. my problem is that I...
2
by: Blacky | last post by:
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.VISIBLE =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
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,...

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.