Changing alternate row color on mouseover

Discussion in 'ASP .Net' started by raoof ahmed khan, May 14, 2008.

  1. Hi All,
    I have a gridview in which i set alternate row color property. Now i want
    to set color change on mouse over and reset it back on mouse out. The
    problem is that when i mouse out it should take the original color back, for
    this i need to know on which row mouse is hovering at present.
    Does anybody know how to catch the current row index.

    Any help would be appreciated.

    Regards.
    raoof ahmed khan, May 14, 2008
    #1
    1. Advertising

  2. You don't need to know the row index. In javascript, you can keep references
    to the previous row and the previous row style:

    var prevRow;
    var savedClass;

    function selectRow (row)
    {
    if(prevRow!=null)
    {prevRow.className=savedClass};
    savedClass=row.className;
    row.className='SelectionGridSelectedItem';
    prevRow=row;
    }


    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "raoof ahmed khan" <raoof ahmed > wrote in
    message news:...
    > Hi All,
    > I have a gridview in which i set alternate row color property. Now i want
    > to set color change on mouse over and reset it back on mouse out. The
    > problem is that when i mouse out it should take the original color back,
    > for
    > this i need to know on which row mouse is hovering at present.
    > Does anybody know how to catch the current row index.
    >
    > Any help would be appreciated.
    >
    > Regards.
    Eliyahu Goldin, May 14, 2008
    #2
    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. G. Whiz
    Replies:
    1
    Views:
    2,844
  2. =?Utf-8?B?aWdvdHlvdXJkb3RuZXQ=?=

    change row color of empty row

    =?Utf-8?B?aWdvdHlvdXJkb3RuZXQ=?=, Oct 19, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    442
    Walter Wang [MSFT]
    Oct 24, 2006
  3. Chris
    Replies:
    2
    Views:
    669
    Chris
    Mar 4, 2007
  4. Replies:
    10
    Views:
    325
    Sean O'Halpin
    Jul 17, 2006
  5. Kamaljeet Saini
    Replies:
    0
    Views:
    386
    Kamaljeet Saini
    Feb 13, 2009
Loading...

Share This Page