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,
Thank you for contacting Infragistics Developer Support!
I was not able to reproduce the behaviour that you're seeing on your side. I have attached the sample project I used to test this. Please test this project on your side; whether or not it works correctly may help indicate the nature of this issue. If this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.Please let me know if I can provide any further assistance.
In case it matters, here's my grid:
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" EnableDataViewState="True" Height="400px" Width="99%" EnableAjax="False" EnableAppStyling="True" StyleSetName="Nautilus"> <GroupingSettings EnableColumnGrouping="True"> </GroupingSettings> <Behaviors> <ig:Sorting EnableInheritance="True"> </ig:Sorting> <ig:Filtering EnableInheritance="True"> </ig:Filtering> <ig:ColumnResizing EnableInheritance="True"> </ig:ColumnResizing> </Behaviors> <AjaxIndicator Enabled="True" ImageUrl="/images/loading.gif" Location="TopCenter" OffsetTop="100" /> </ig:WebHierarchicalDataGrid>
Thanks so much! I see using debug that you are correct, and the event is in fact firing. I'm sorry for assuming it wasn't. It appears that it's the oColumn.HtmlEncode that is not working correctly on the first row. The event is firing, and HtmlEncode is set to false, other rows display links properly, but the first row does not, even if it's identical to other rows.
In your example code, you could add html, such as
row.SetField(Of String)("Address", "<a href=""http://es.infragistics.com"">Paris</a>")
row.SetField(Of String)("Address", "<a href=""http://es.infragistics.com"">Rome</a>")
And then test for href= by:
And you will see the problem.