This is a migrated thread and some comments may be shown as answers.

Adding attributes to PivotGridAggregateField

2 Answers 124 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Julian
Top achievements
Rank 1
Julian asked on 15 Apr 2015, 10:21 PM

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:

 

123.43

0.00

 

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

EmptyDataText

DataFormatString

FooterAggregateFormatString

 

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?

 

Thanks,

 Julian

 

2 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 20 Apr 2015, 08:53 AM
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">


Regards,
Kostadin
Telerik
 

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

 
0
Julian
Top achievements
Rank 1
answered on 20 Apr 2015, 01:16 PM
Thank you Kostadin!
Tags
PivotGrid
Asked by
Julian
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Julian
Top achievements
Rank 1
Share this question
or