I have a pivot grid to show some information, kind of a report, where the user can select a dates, From and To, and have to show a master header with the year, and right below the months, depending on what the user select. Now I have the years, and the months showing as I want except that I am showing the month number, not the month year (ex: 1 instead of January). I want to show January instead of 1. Here is the code and I attach some pictures.
Code behind:
Any Help??
<telerik:RadPivotGrid ID="RadPivotGrid1" runat="server" Skin="Glow" OnNeedDataSource="RadPivotGrid1_OnNeedDataSource" AllowFiltering="False" RowTableLayout="Tabular" AggregatesPosition="Columns" ShowColumnHeaderZone="False" ShowDataHeaderZone="False" ShowRowHeaderZone="False" AllowPaging="True" PageSize="50" ShowFilterHeaderZone="false" AggregatesLevel="2" TotalsSettings-ColumnGrandTotalsPosition="None" TotalsSettings-RowGrandTotalsPosition="Last" > <PagerStyle ChangePageSizeButtonToolTip="Change Page Size" PageSizeControlType="RadComboBox"></PagerStyle> <Fields> <telerik:PivotGridColumnField DataField="Year" UniqueName="Year" Caption="Year"> </telerik:PivotGridColumnField> <telerik:PivotGridColumnField DataField="Month" UniqueName="Month" Caption="Month"> </telerik:PivotGridColumnField> <telerik:PivotGridRowField DataField="DestinationName" UniqueName="DestinationName" Caption="Destination"> </telerik:PivotGridRowField> <telerik:PivotGridAggregateField DataFormatString="{0:N0}" DataField="Teus" UniqueName="Teus" Caption="Teus"> <TotalFormat Axis="Rows" Level="0" SortOrder="Ascending" TotalFunction="NoCalculation" /> <HeaderCellTemplate> <asp:Label ID="lblAggregateCellTEUS" Text="Calculated TEUS" runat="server" /> </HeaderCellTemplate> </telerik:PivotGridAggregateField> <telerik:PivotGridAggregateField DataFormatString="{0:C}" DataField="TotalCharge" UniqueName="TotalCharge" Caption="TotalCharge"> <TotalFormat Axis="Rows" Level="0" SortOrder="Ascending" TotalFunction="NoCalculation" /> <HeaderCellTemplate> <asp:Label ID="lblAggregateCellTotalCharge" Text="Total Charges" runat="server" /> </HeaderCellTemplate> </telerik:PivotGridAggregateField> </Fields> </telerik:RadPivotGrid>Code behind:
private List<Result> LoadGridData() { var result = new List<Result>(); result.Add(new Result() { Year = 2014, Month = 1, DestinationName = "Miami, FL", DestinationShortName = "MIA", OriginName = "Miami, FL", OriginShortName = "MIA", TotalCharge = 100, Teus = (decimal) 1.5 }); result.Add(new Result() { Year = 2013, Month = 1, DestinationName = "Miami, FL", DestinationShortName = "MIA", OriginName = "Miami, FL", OriginShortName = "MIA", TotalCharge = 100, Teus = (decimal)1.5 }); result.Add(new Result() { Year = 2014, Month = 2, DestinationName = "Houston, Tx", DestinationShortName = "Hou", OriginName = "Miami, FL", OriginShortName = "MIA", TotalCharge = 80, Teus = 2 }); result.Add(new Result() { Year = 2014, Month = 1, DestinationName = "Houston, Tx", DestinationShortName = "Hou", OriginName = "Miami, FL", OriginShortName = "MIA", TotalCharge = 80, Teus = 2 }); return result; } protected void RadPivotGrid1_OnNeedDataSource(object sender, PivotGridNeedDataSourceEventArgs e) { RadPivotGrid1.DataSource = LoadGridData(); }Any Help??
