asp.netgridviewresourcesdatatemplateheadertext

Text with resources and HTML in TemplateField


I nedd to insert a text in resource file with html in the attribute HeaderText of a TemplateField.. I cant use an HeaderTemplate because the sorting does not work... Neither with this solution (the datasource result in null).

So im trying a solution like this:

HeaderText="<span><%$ Resources:ForumResources, DATA_CREAZIONE %></span><img src="..." />"

But it is rendered like this:

<span><!-- Resources:ForumResources, DATA_CREAZIONE --></span>
<img src="..." />"

Like a comment, why? How can i solve this?

Thanx


Solution

  • I think you should be using like this

    gridview1.Columns[ColumnIndex].HeaderText = "Header text";
    
    gridview1.Columns[ColumnIndex].HeaderText =
                                        Resources:ForumResources, DATA_CREAZIONE;