1

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

Simone
  • 2,304
  • 6
  • 30
  • 79

2 Answers2

1

I think you should be using like this

gridview1.Columns[ColumnIndex].HeaderText = "Header text";

gridview1.Columns[ColumnIndex].HeaderText =
                                    Resources:ForumResources, DATA_CREAZIONE;
शेखर
  • 17,412
  • 13
  • 61
  • 117
  • It has worked finally... thak you very much!!!!! Id like to know how to do from aspx page... just curiosity... i think it is possible... but it's ok... thanx again – Simone Apr 04 '13 at 10:10
  • kindly mark the answer if it helped you. Also I don't know any way of doing it from apsx page. – शेखर Apr 04 '13 at 10:26
0

Call A function that retur string like u want....

DO THIS just AFTER binding ur gridview

gridview1.Columns[ColumnIndex].HeaderText =getstring();

        public string getstring()
        {
        string str="<span>"+yourcontent in the form of string+"</span><img src="..." />";
        return str;
        }
Amit Singh
  • 8,039
  • 20
  • 29
  • 1
    No :( Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.TemplateField does not have a DataBinding event. I've also tried with <%= instead of <%# but it result in – Simone Apr 04 '13 at 09:48