malc77
asked on
Changing Background color and borders ASP.Net DataGrid's ToolTip
I'm using ASP.Net (VB.Net) 2005. Working specifically with the Telerik RadGrid which is inherited from Microsoft's Datagrid. I am reading my ToolTips from xml which I convert into a dataset and bind to the grid. That part works fine. My question is: What is an easy way to add a style to the ToolTip on the datagrid? For example my tooltip's background needs to be blue with black borders. Here is a sniplet of how I am binding the data to the templategridcolumn and tooltip:
'******************Client side Code ************************** ********** ******
<radG:GridTemplateColumn DataField="DESC" Groupable="False" UniqueName="DESC" >
<ItemStyle horizontalalign="Left" VerticalAlign="Middle" Height="20px"></ItemStyle>
<headertemplate>T</headert emplate>
<itemtemplate>
<asp:Label id="lblDes" Runat="server" ToolTip='<% #GetToolTip(Container.Data Item ,"DESC")%>'>
<%#FormatColumn(Container. DataItem, "DESC")%></asp:Label>
</itemtemplate>
</radG:GridTemplateColumn>
'*******************Code Behind**************
Public Function GetToolTip(ByVal dRowView As DataRowView, ByVal colName As String, Optional ByVal desc As String = "") As String
If (dRowView.Row.Table.Column s.Contains (colName)) Then
If (Not IsDBNull(dRowView.Row.Item (colName)) ) Then
If (colName = "DESC") Then
If (CType(dRowView.Row.Item(c olName), String) = "FW") Then
Return "Forward Align"
ElseIf (CType(dRowView.Row.Item(c olName), String) = "RE" Or CType(dRowView.Row.Item(co lName), String) = "RW") Then
Return "Rear Wheel"
ElseIf (CType(dRowView.Row.Item(c olName), String) = "BW") Then
Return "Back Wheel"
End If
Else
Return desc
End If
Else
Return String.Empty
End If
Else
Return String.Empty
End If
End Function
'******************Client side Code **************************
<radG:GridTemplateColumn DataField="DESC" Groupable="False" UniqueName="DESC" >
<ItemStyle horizontalalign="Left" VerticalAlign="Middle" Height="20px"></ItemStyle>
<headertemplate>T</headert
<itemtemplate>
<asp:Label id="lblDes" Runat="server" ToolTip='<% #GetToolTip(Container.Data
<%#FormatColumn(Container.
</itemtemplate>
</radG:GridTemplateColumn>
'*******************Code Behind**************
Public Function GetToolTip(ByVal dRowView As DataRowView, ByVal colName As String, Optional ByVal desc As String = "") As String
If (dRowView.Row.Table.Column
If (Not IsDBNull(dRowView.Row.Item
If (colName = "DESC") Then
If (CType(dRowView.Row.Item(c
Return "Forward Align"
ElseIf (CType(dRowView.Row.Item(c
Return "Rear Wheel"
ElseIf (CType(dRowView.Row.Item(c
Return "Back Wheel"
End If
Else
Return desc
End If
Else
Return String.Empty
End If
Else
Return String.Empty
End If
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.