mouseover effect

Discussion in 'ASP .Net Datagrid Control' started by Bart, Jan 5, 2005.

  1. Bart

    Bart Guest

    I want to create a mouseover effect which colors the row when the
    mousepointer goes over a row. I use this code in the itemDataBound event

    If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
    ListItemType.AlternatingItem Then
    e.Item.Attributes.Add("onMouseOver",
    "this.style.backgroundColor='Silver'")
    e.Item.Attributes.Add("onmouseout",
    "this.style.backgroundColor='white'")
    e.Item.Style("cursor") = "hand"
    End If

    The code works fine. But when I attach a stylesheet (css) to the page, the
    mouseover won't work anymore. It seems that the stylesheet 'overrules' all
    other attributes. Any idea how to solve this ?

    Bart
     
    Bart, Jan 5, 2005
    #1
    1. Advertising

  2. Hi bart all my pages have stylesheets attached to it, but my color change
    still works. Style sheet does not cause any problems. Maybe you are
    overlooking something else?
    HTHs...

    "Bart" wrote:

    > I want to create a mouseover effect which colors the row when the
    > mousepointer goes over a row. I use this code in the itemDataBound event
    >
    > If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
    > ListItemType.AlternatingItem Then
    > e.Item.Attributes.Add("onMouseOver",
    > "this.style.backgroundColor='Silver'")
    > e.Item.Attributes.Add("onmouseout",
    > "this.style.backgroundColor='white'")
    > e.Item.Style("cursor") = "hand"
    > End If
    >
    > The code works fine. But when I attach a stylesheet (css) to the page, the
    > mouseover won't work anymore. It seems that the stylesheet 'overrules' all
    > other attributes. Any idea how to solve this ?
    >
    > Bart
     
    R. Thomas, aka Xtreme.Net, Jan 7, 2005
    #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. =?Utf-8?B?QUNhdW50ZXI=?=

    mouseOver effect

    =?Utf-8?B?QUNhdW50ZXI=?=, Feb 1, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    479
    Gopal \(FMS, Inc.\)
    Feb 1, 2005
  2. Bendik Engebretsen

    Mouseover effect on imagebutton

    Bendik Engebretsen, Aug 3, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    22,542
    shadowzz
    Sep 2, 2010
  3. Dariusz Tomon
    Replies:
    2
    Views:
    892
  4. Larry

    Mouseover effect

    Larry, Oct 31, 2004, in forum: HTML
    Replies:
    5
    Views:
    530
  5. AndrewC
    Replies:
    2
    Views:
    174
    jdalton
    Apr 30, 2008
Loading...

Share This Page