Programmatically set headertext of a boundfield column

Discussion in 'ASP .Net' started by John Mason, Aug 20, 2006.

  1. John Mason

    John Mason Guest

    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.



    *** Sent via Developersdex http://www.developersdex.com ***
    John Mason, Aug 20, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QWxlc3NhbmRybyBSb3NzaQ==?=

    Set Column Headertext

    =?Utf-8?B?QWxlc3NhbmRybyBSb3NzaQ==?=, Feb 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    322
    Martin Dechev
    Feb 27, 2004
  2. michel
    Replies:
    1
    Views:
    916
    michel
    Feb 17, 2007
  3. Mark A Gregory

    Column HeaderText set at runtime?

    Mark A Gregory, Jul 19, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    116
    Mark A Gregory
    Jul 19, 2003
  4. Ravi Gudlavalleti

    How do I change the headertext of a datagrid column programmatically

    Ravi Gudlavalleti, Jun 17, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    193
    Ken Cox [Microsoft MVP]
    Jun 18, 2004
  5. Replies:
    2
    Views:
    229
    jyoti
    Aug 19, 2006
Loading...

Share This Page