Adding attributes to PivotGridAggregateField

3 posts, 0 answers
  1. Julian
    Julian avatar
    54 posts
    Member since:
    Apr 2015

    Posted 15 Apr 2015 Link to this post

    I have a webpage that has a regular RadGrid with GridBoundColumns and GridNumericColumns. 

    During the excel export the formatting of my numerical data seems to get lost. Columns that appear on the grid on the page will look like:





    The aspx for the regular RadGrid has code that another developer wrote that includes attributes:





    Here is what that looks like:


    <telerik:GridNumericColumn DataField="revenue" EmptyDataText="0.00" HeaderText="Revenue" DataFormatString="{0:#,##0.00;(#,##0.00)}"<br>                        Groupable="false" UniqueName="revenue" Aggregate="Sum" FooterText=" " FooterAggregateFormatString="{0:#,##0.00;(#,##0.00)}"><br>                        <HeaderStyle HorizontalAlign="Center" /><br>                        <ItemStyle HorizontalAlign="Right" Wrap="false" /><br>                        <FooterStyle HorizontalAlign="Right" Wrap="false" /><br>                    </telerik:GridNumericColumn>


    In the RadPivotGrid the similar column to above appears like so:


    <telerik:PivotGridAggregateField DataField="actualValue" Aggregate="Sum"><br>                    <HeaderCellTemplate><br>                        <asp:Label ID="lblActualValue" Text="Actual" runat="server" /><br>                    </HeaderCellTemplate><br>                </telerik:PivotGridAggregateField>

    So how can I add the attriutes I mentioned to the PivotGridAggregateField?





  2. Kostadin
    Kostadin avatar
    1711 posts

    Posted 20 Apr 2015 Link to this post

    Hello Julian,

    Since RadGrid and RadPivotGrid controls might looks indentical their structure is quite different. Note that RadPivotGrid does not have a footer and instead that there is a Total and Grand Total rows. Note that you can add the attributes to the PivotGridAggregateField as follow.
    <telerik:PivotGridAggregateField DataField="Quantity" Aggregate="Sum" DataFormatString="{0:#,##0.00;(#,##0.00)}"  TotalFormatString="{0:#,##0.00;(#,##0.00)}" GrandTotalAggregateFormatString="{0:#,##0.00;(#,##0.00)}" >

    Additionally there isn't an EmptyDataText for each filed and you can specify a global empty text for all empty cells in the PivotGrid. For this purpose you have to use its EmptyValue property.
    <telerik:RadPivotGrid AllowFiltering="true"  OnNeedDataSource="RadPivotGrid1_NeedDataSource" ID="RadPivotGrid1" runat="server" EmptyValue="Empty value">


    See What's Next in App Development. Register for TelerikNEXT.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Julian
    Julian avatar
    54 posts
    Member since:
    Apr 2015

    Posted 20 Apr 2015 in reply to Kostadin Link to this post

    Thank you Kostadin!
Back to Top