DataGrid Row Highlighting

Results 1 to 2 of 2

Thread: DataGrid Row Highlighting

  1. #1
    Join Date
    Dec 1969

    Default DataGrid Row Highlighting

    Is there an easy way to have a datagrid row change background color when the mouse cursor passes over it and then change back to it&#039;s previous background color when the mouse it moved off of it?<BR><BR>In ASP 3.0 I used the from Microsoft and it worked okay (wasn&#039;t consistent at times). Is there something better for a .Net DataGrid control?<BR><BR>Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: DataGrid Row Highlighting

    Wire-up the ItemCreated event handler and add a mouse-over script to the TableRow (TR):<BR><BR><BR>Protected Sub ItemCreated(ByVal sender As Object, ByVal e As DataGridItemEventArgs)<BR> If (e.Item.ItemType = ListItemType.Item Or _<BR> e.Item.ItemType = ListItemType.AlternatingItem) Then<BR> Dim row As TableRow = CType(e.Item, TableRow)<BR> row.Attributes.Add("onmouseover", ";Gold&#039;;")<BR> row.Attributes.Add("onmouseout", ";Brown&#039;; ")<BR> End If<BR>End Sub<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts