How do I customize the column header?

5 posts, 0 answers
  1. Joseph
    Joseph avatar
    1 posts
    Member since:
    May 2012

    Posted 06 Feb 2013 Link to this post

    I have a column that sums the "rev" field.  The heading reads "Sum of rev".  For consistency with existing reports, I would like that to read "Total Revenue", but I can't find the property or event where I can change it.
  2. Svett
    Admin
    Svett avatar
    728 posts

    Posted 11 Feb 2013 Link to this post

    Hello Joseph,

    Thank you for writing.

    If you want to change the text of the column's header, you can do that by setting the column's
    HeaderText property. You can refer the online documentation regarding this.

    I hope this helps.

    All the best,
    Svett
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 11 Feb 2013 Link to this post

    Let me follow up on this case. In the previous post, by mistake you was provided with information how to set the header text in RadGridView not in RadPivotGrid. 

    To do that in RadPivotGrid you have to use the CustomName property of the PropertyAggregateDescriptor:
    this.radPivotGrid1.AggregateDescriptions.Add(new PropertyAggregateDescription() { PropertyName = "Freight", AggregateFunction = AggregateFunctions.Sum, CustomName = "this is the custom header text" });

    I hope this helps.
     
    Kind regards,
    Stefan
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
  5. steven littleford
    steven littleford avatar
    5 posts
    Member since:
    May 2010

    Posted 27 Nov 2013 Link to this post


    If you want to do it on the fly based on the data then you need to use the 

    GroupElementFormatting 

    event.....

    However, there seem to be no way to find out what group the e.GroupElement belongs to.....

    stefan, any ideas here?


  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 02 Dec 2013 Link to this post

    Hello Steven,

    As you were informed in the other thread you asked this question in, you can access the group in the GroupElementFormatting event handler with the following line of code:
    IGroup group = e.GroupElement.Data.Group;

    Regards,
    Stefan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>


Back to Top
UI for WinForms is Visual Studio 2017 Ready