Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataGrid Client Side row selection

Reply
Thread Tools

DataGrid Client Side row selection

 
 
=?Utf-8?B?QmlkYXJrb3Rh?=
Guest
Posts: n/a
 
      05-23-2005
I have a Datagrid and i need a functionality to set the row of a datagrid to
a color(blue) when i click on the DataGrid row. I have a check box in the
DataGrid Header if i select the checkbox all the rows in the datagrid are set
with the color(blue) at client side. i wrote the code but it is giving
problems. can you pls help me out in solving this problem. code is below:

var selectedRow = null;
function fnSelectRow(rowObject)
{
if (selectedRow != null)
{
selectedRow.style.backgroundColor = '#ffffff';
}
selectedRow = rowObject;
selectedRow.style.backgroundColor = '#CAD3E4';
}


function fnSelectAll(chkVal, DataGrid1)
{

if(document.getElementsByTagName)
{
var table = document.getElementById(DataGrid1);
var rows = table.getElementsByTagName("tr");
for (i=0;i<eval(rows.length); i++)
{
rows[i].className="even";
}
if(chkVal == true)
{
for(i = 1; i < eval(rows.length-1); i++)
{

rows[i].className = "odd";
}
}
else
{
rows[1].className = "odd";
for(i = 2; i < eval(rows.length-1); i++)
{
rows[i].className = "even";
}
}
}

}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView row selection with client side script tomix ASP .Net Web Controls 0 10-17-2006 07:43 PM
DataGrid Add Row Client Side =?Utf-8?B?Sm9u?= ASP .Net 1 05-19-2005 01:09 PM
DataGrid rows selection at client side =?Utf-8?B?QmlkYXJrb3Rh?= ASP .Net 1 05-17-2005 09:28 AM
JTable with row selection, but no cell selection Simon Niederberger Java 2 01-07-2005 04:17 PM
datagrid and client side scripts to add row John Smith ASP .Net Datagrid Control 0 09-30-2004 06:58 AM



Advertisments