HI, thanks for this but I am afraid I have already tried this. Infact it was my first effort as I already use this event to assign the row color dependent upon data values by just setting the the row cssclass, which works. It just appears to be an issue when trying to add an attribute.
Have you had the code above work on a gridview with CSS Friendly adapters on? As I say if I turn off friendly adapters the attributes are added, if friendly adapters is on then the attributes are not added. I have single step through the code and it all executes fine with now errors, just the output never makes it to the html.
Below I show the code I have already for the RoDatabound event (I have added your code above, just incase I was missing something but it has not worked). Also below that code extract I show the html output with friendly adapter turned on and off.
Protected Sub GridView_Institutes_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If Not DBNull.Value.Equals(e.Row.DataItem("inst_f")) Then
If (e.Row.DataItem("inst_f") = True) Then
e.Row.CssClass = "gridViewRowActive"
ElseIf (e.Row.DataItem("inst_f") = False) Then
e.Row.CssClass = "gridViewRowActiveNot"
End If
End If
End If
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes("onmouseover") = "this.style.backgroundColor='lightblue';"
e.Row.Attributes("onmouseout") = "this.style.backgroundColor='';"
e.Row.Attributes("style") = "cursor:pointer"
End If
End Sub
HTML output with Friendly adapters on.
<tbody>
<tr class="gridViewRowActive AspNet-GridView-Normal">
<td>
<input type="submit" name="ctl00$ContentPlaceHolder1....
HTML output with Friendly adapters off.
<tr class="gridViewRowActive" onmouseover="this.style.backgroundColor='lightblue';" onmouseout="this.style.backgroundColor='';" style="cursor:pointer">
<td>
<input type="submit" name="ctl00$ContentPlaceHolder1...