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,
In order to work with filtering you can change the selector to be td.nowrap[role="gridcell"] and this way it will not be matching the filtering cell and the header, then you can get the 0 element from the collection.
function WebHierarchicalDataGrid_Initialize(sender, eventArgs) { var $encodedCell = $($('td.nowrapHTML[role="gridcell"]')[0]); $encodedCell.html($encodedCell.text()); }
Let me know if you need further assistance.
I was able to break your sample by enabling filtering. I'm not sure if that's the only difference, so I'm continuing to test my app vs. your sample. We definitely need filtering.
I did yes, however I'm not able to implement this workaround in this way, as this is an inherited user control. I attempted to implement it, but it didn't work.
Did you look at my sample?
It did not resolve the issue in the production app, no. It's a DotNetNuke module, so I used JavaScript.RequestRegistration(CommonJs.jQuery) to initialize jQuery. Also I had to use Page.ClientScript.RegisterClientScriptBlock, which puts the script inside HEAD.
Viewing the source, I can see that jQuery is initialized (v1.9.1), and the script is in the HEAD, but still no luck.
Can the grid not be fixed?