Programmatically set headertext of a boundfield column

J

John Mason

Hi,

I am trying to find out if there is a way to set the headertext of the
boundfield column belonging to a detailsview control (ASP.NET 2.0), from
code.

<asp:BoundField HtmlEncode="false" DataFormatString="{0:###0.00}"
DataField="wage_cash" HeaderText='<%# Format_Header("wage1") %>'
SortExpression="wage_cash" />

The above example doesn't work:
"Databinding expressions are only supported on objects that have a
DataBinding event."

I would like to set the headertext within the DetailsView_PreRender sub,
so that the header displays the current financial year.

I'd prefer not to convert the above to a TemplateField column, because
of the formatting used - DataFormatString="{0:###0.00}"

Any help (with vb.net examples) would be especially appreciated!

Thanks,

John.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top