mouseover highlight of datagrid row

Discussion in 'ASP .Net' started by TJS, Feb 17, 2004.

  1. TJS

    TJS Guest

    trying to use this code for mouseover highlight of row but it is not working
    on the datagrid, nothing happens.
    Page compiles without errors but no highlighting effects take place.

    can anyone tell me what is missing ?



    Sub Grid_ItemDataBound(ByVal sender As Object, ByVal e As
    DataGridItemEventArgs)

    If e.Item.ItemType = ListItemType.Item Or _
    e.Item.ItemType = ListItemType.AlternatingItem Then
    '---------------------------------------------------
    ' Add the OnMouseOver and OnMouseOut method to the Row of DataGrid
    '---------------------------------------------------
    e.Item.Attributes.Add("onmouseover",
    "this.style.backgroundColor='Silver'")
    e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='White'")
    End If

    End Sub
    TJS, Feb 17, 2004
    #1
    1. Advertising

  2. Hi
    The code is right
    Please check the following
    1. The 'asp:DataGrid ID' tag should have an ItemDataBound event mentioned
    eg: <asp:DataGrid ID="ItemsGrid" AutoGenerateColumns="False" OnItemDataBound = "ItemsGrid_Bound" Runat="server"

    2. Manually register the event-handling method (Grid_ItemDataBound in your case) for the ItemDataBound event of the data grid

    It worked for me. Only diff is that my code was in C#

    HT
    Regards
    -am
    =?Utf-8?B?QW5hbmQgTW9oYW4=?=, Feb 17, 2004
    #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?YmFjazJncmlk?=

    highlight datagrid row on radiobutton selection

    =?Utf-8?B?YmFjazJncmlk?=, Sep 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    462
    =?Utf-8?B?YmFjazJncmlk?=
    Sep 13, 2004
  2. =?Utf-8?B?TWlrZQ==?=

    highlight datagrid row when clicked

    =?Utf-8?B?TWlrZQ==?=, Nov 9, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,921
  3. Fernando Lopes
    Replies:
    0
    Views:
    3,181
    Fernando Lopes
    Apr 28, 2005
  4. kaston3
    Replies:
    1
    Views:
    549
    Andrew Bailey
    Feb 19, 2008
  5. TJS

    highlight row on mouseover

    TJS, Feb 17, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    135
    Renato Aloi
    Feb 17, 2004
Loading...

Share This Page