Click here to Skip to main content
Click here to Skip to main content
Alternative Tip
Go to top

Click/select Row in ASP.NET GridView or HTML Table

, 28 Dec 2011
Rate this:
Please Sign up or sign in to vote.
Following are optimized code for SelectRow functionStylesheet.selectedRow{color: #303030;font-size:3em;font-weight:bold;}.normalRow{color: #909090;font-size:2em;font-weight:normal;}Javascriptfunction SelectRow(row) { // get all data rows - siblings to...
Following are optimized code for SelectRow function
 
Stylesheet
.selectedRow
{
color: #303030;
font-size:3em;
font-weight:bold;
}
.normalRow
{
color: #909090;
font-size:2em;
font-weight:normal;
}
 
Javascript
function SelectRow(row) {
  // get all data rows - siblings to current
  var _rows = row.parentNode.childNodes;
  // deselect all data rows
  try {
     for (i = 0; i < _rows.length; i++) {
     _rows[i].getElementsByTagName("td")[0].className='normalRow';
      }
  }
  catch (e) { }
  // select current row (formatting applied to first cell)
row.getElementsByTagName("td")[0].className='selectedRow';
  }
 
Thanks,
Imdadhusen

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sunasara Imdadhusen
Software Developer (Senior) Infostretch Ahmedabad-Gujarat
India India
Aspiring for a challenging carrier wherein I can learn, grow, expand and share my existing knowledge in meaningful and coherent way.

sunaSaRa Imdadhusen
 
AWARDS:
  1. 1st Best Asp.Net article of SEP 2010
  2. 2nd Best Asp.Net article of MAY 2011
 
Read More Articles...
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
GeneralI have pointed to that option earlier in comments thread (se... PinmemberDrABELL28-Dec-11 3:12 
GeneralRe: I have pointed to that option earlier in comments thread (se... PinprofessionalSunasara Imdadhusen22-Apr-14 4:04 
GeneralRe: I have pointed to that option earlier in comments thread (se... PinprofessionalDrABELL22-Apr-14 9:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 28 Dec 2011
Article Copyright 2011 by Sunasara Imdadhusen
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid