DataGrid Client Side row selection

Discussion in 'ASP .Net' started by =?Utf-8?B?QmlkYXJrb3Rh?=, May 23, 2005.

  1. 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.className="even";
    }
    if(chkVal == true)
    {
    for(i = 1; i < eval(rows.length-1); i++)
    {

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

    }
     
    =?Utf-8?B?QmlkYXJrb3Rh?=, May 23, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QmlkYXJrb3Rh?=

    DataGrid rows selection at client side

    =?Utf-8?B?QmlkYXJrb3Rh?=, May 16, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    396
    Eliyahu Goldin
    May 17, 2005
  2. Simon Niederberger
    Replies:
    2
    Views:
    16,535
    Christian Kaufhold
    Jan 7, 2005
  3. Boss302
    Replies:
    0
    Views:
    1,056
    Boss302
    Nov 21, 2006
  4. Bogdan
    Replies:
    2
    Views:
    655
    Bogdan
    Jun 9, 2008
  5. tomix

    GridView row selection with client side script

    tomix, Oct 17, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    170
    tomix
    Oct 17, 2006
Loading...

Share This Page