I have the following code in a WebHierarchicalDataGrid's InitializeRow event in order to format html links when I don't know if or where they will be in the datatable. It's been working great for years, but within the last year something has broken, and it no longer formats the first row. All other rows are formatted fine. I can't know for sure which version this first popped up in, but I know it exists in 12.2.20142.2146.
If e.Row.Items.Count > 0 Then
For i As Integer = 0 To e.Row.Items.Count - 1
If e.Row.Items(i).Text.ToLower.Contains("href=") Then
Dim oColumn As BoundDataField = CType(e.Row.Items(i).Column, BoundDataField)
oColumn.HtmlEncode = False
oColumn.CssClass = "nowrapHTML"
End If
Next
Hello Clinton,
I am glad that I have managed to help you.
Please let me know if I may be of further assistance.
Thank you for choosing our components!
This second method worked for me. Thank you!
You can set HtmlEncode to false for the entire column if it is containing only hyperlinks as so.
Private Sub WebHierarchicalDataGrid1_InitializeRow(sender As Object, e As Infragistics.Web.UI.GridControls.RowEventArgs) Handles Grid.InitializeRow Dim oColumn As BoundDataField = CType(e.Row.Items(1).Column, BoundDataField) oColumn.HtmlEncode = False oColumn.CssClass = "nowrapHTML" End Sub
If this workaround is not possible for you can decode the first row by using HtmlDecode method of HttpUtility.
Private Sub WebHierarchicalDataGrid1_InitializeRow(sender As Object, e As Infragistics.Web.UI.GridControls.RowEventArgs) Handles Grid.InitializeRow If e.Row.Items.Count > 0 Then For i As Integer = 0 To e.Row.Items.Count - 1 If e.Row.Items(i).Text.ToLower.Contains("href=") Then Dim oColumn As BoundDataField = CType(e.Row.Items(i).Column, BoundDataField) oColumn.HtmlEncode = False oColumn.CssClass = "nowrapHTML" If e.Row.Index = 0 Then e.Row.Items(i).Text = HttpUtility.HtmlDecode(e.Row.Items(i).Text) End If End If Next End If End Sub
Thank you for reporting this.
I have asked our engineering staff to examine this further. To ensure that it will receive attention, I have logged this behavior in our internal tracking system with a Development ID of 192575. A support case is created on your behalf with number CAS-152729-Y3X0N9, so that you can be notified when the this is fixed. You can find your active cases under Account - Support Activity in our website. Select your ticket and go to Development Issues tab to view the status of related development issues.
Let me know if I may be of further assistance.
Will this bug be resolved in an upcoming service release? As I said, our module is dynamic, and has many possible configurations. Your workaround is not going to address them all. I'd much rather the grid just work as designed.