Prevent HTML encoding in auto-generated GridView columns

前端 未结 7 2119
渐次进展
渐次进展 2020-11-27 06:46

I have a GridView bound to a DataTable that I construct. Most columns in the table contain the raw HTML for a hypelinklink, and I would like that HTML to render as a link i

7条回答
  •  执念已碎
    2020-11-27 07:17

    Another way is to add something like the following to the RowDataBound event handler...

        If e.Row.RowType = DataControlRowType.Header Then
            For Each col As TableCell In e.Row.Cells
                Dim encoded As String = col.Text
                col.Text = Context.Server.HtmlDecode(encoded)
            Next
        End If
    

提交回复
热议问题