Looking at the example, I want to disable and hide the expand/collapse button for that row where the value = "XXX"
Can i do this in the prerender event easily?
19 Answers, 1 is accepted
You can hide the expand button in PivotGridRowHeaderCell with text "XXXX" using the code snippet below:
protected
void
rpg_CellDataBound(
object
sender, PivotGridCellDataBoundEventArgs e)
{
{
if
(e.Cell
is
PivotGridRowHeaderCell)
{
if
(e.Cell.Controls.Count>1 && (e.Cell.Controls[1]
as
Literal).Text ==
"XXXX"
)
{
(e.Cell.Controls[0]
as
Button).Visible =
false
;
}
}
}
}
I hope this helps.
Greetings,
Pavlina
the Telerik team

I have Rad Pivot grid. that grid 4 filter values there. I have drag and drop pull the field in filter box. i want which data i have to drag and drop in the filter box. for example(rowheader filter, olumn header filter, aggregate filter, filter box).
I need the answer for this. any body have answer means help me.

I need to collect the data count which we drag and drop in aggregate field. how can we collect it.. any properties is there for those four fields, Aggregate, filter,Row,Column.
Thanks,
Prabu
Can you specify what do you mean by "data"? If you need an information about pivot grid fields you can use the code below:
RadPivotGrid1.Fields.Where(f => f
is
PivotGridRowField)
Thus you will be able to receive all row fields and using the same approach you can get all other fields.
Regards,
Pavlina
Telerik

Here the data is Quantity in Aggregate Field so, Quantity is my data, if any field i drag and drop in aggregate filed i need to get that data.. so how its possible.
Thanks,
Prabu

Here the Data is Quantity in aggregate field. i need to store the data in a list that which data is belongs to which field. for example here i drag and drop the quantity in aggregate Field likewise category and Product name in Row field. so i need to store these data in a list. if i check with the list, i need to get these data.Is there any properties to implement this scenario. please advice
Thanks,
prabu
Did you try using the approach suggested in the previous post for getting the field data? You have access to the pivot grid's fields in the Fields collection of the controls. Therefrom you can retrieve any field you need by unique name or any other parameter using a linq query. Once you have the field you can store the data in a list and apply your custom logic in order to achieve your application requirements.
Regards,
Pavlina
Telerik

Thanks for your guide, I got all field details in a list and saved in database. need one more favor i have saved Many number combination of field data collection in a database. i need to get the particular field collection data and rebind all the field details from database to radpivotgrid using some where condition . please advice
Thanks,
Prabu
May I ask you to open a support ticket and provide a sample runnable project which can help us to understand the logic of your application. Thus we would be able to advise you more accurately.
Thank you!
Regards,
Pavlina
Telerik

I have saved all field details(rowfield,FilterField,Columnfield,Aggregatefield)with selected data in a database. while i rebind it dynamically from database to radpivotgrid fields . i am getting error " Multiple controls with the same ID 'id_Hidden' were found. FindControl requires that controls have unique IDs ".. pls advice how to rebind dynamically from database to radpivotgrid.
Thanks,
Prabu.
It is very likely that you get this error message because you have two different fields with the same UniqueName. The UniqueName should be different for each of the pivotgrid fields.
Regards,
Pavlina
Telerik

Hi telerik Team,
How to change the Aggregate function for specific rows .I am using rowsubtotals and using aggregate as sum for aggregate columns.but want some row subtotals calculated as average instead of sum.Please find the attached screen shot will show oil price is summed up instead of average.
For example :
First 5 rows-subtotal have an aggregate as sum and the price rows need average aggregate.currently i am not able find any property or solution to calculate the average.please help any one have solution
below is aspx markup
<
telerik:RadPivotGrid
ID
=
"RPG_Variance"
AllowPaging
=
"false"
PageSize
=
"10"
Skin
=
"Metro"
Height
=
"460px"
RowGroupsDefaultExpanded
=
"false"
TotalsSettings-RowsSubTotalsPosition
=
"First"
RowTableLayout
=
"Outline"
AccessibilitySettings-ColumnHeaderTableCaption
=
""
TotalsSettings-ColumnGrandTotalsPosition
=
"None"
TotalsSettings-RowGrandTotalsPosition
=
"None"
OnCellDataBound
=
"RPG_Variance_CellDataBound"
AllowFiltering
=
"false"
ShowFilterHeaderZone
=
"false"
OnNeedDataSource
=
"RPG_Variance_NeedDataSource"
ShowDataHeaderZone
=
"false"
runat
=
"server"
ShowColumnHeaderZone
=
"false"
>
<
ClientSettings
EnableFieldsDragDrop
=
"false"
>
<
Scrolling
AllowVerticalScroll
=
"true"
ScrollHeight
=
"460px"
SaveScrollPosition
=
"true"
></
Scrolling
>
</
ClientSettings
>
<
Fields
>
<
telerik:PivotGridRowField
DataField
=
"Category"
CellStyle-Width
=
"200px"
SortOrder
=
"None"
>
</
telerik:PivotGridRowField
>
<
telerik:PivotGridRowField
DataField
=
"Budget"
CellStyle-Width
=
"200px"
SortOrder
=
"None"
>
</
telerik:PivotGridRowField
>
<
telerik:PivotGridColumnField
DataField
=
"MonthDate"
CellStyle-Width
=
"50px"
SortOrder
=
"None"
>
</
telerik:PivotGridColumnField
>
<
telerik:PivotGridAggregateField
DataField
=
"Original"
Aggregate
=
"Sum"
CellStyle-Width
=
"90px"
DataFormatString
=
"{0:N2}"
>
</
telerik:PivotGridAggregateField
>
<
telerik:PivotGridAggregateField
DataField
=
"Scenario"
Aggregate
=
"Sum"
CellStyle-Width
=
"90px"
DataFormatString
=
"{0:N2}"
>
</
telerik:PivotGridAggregateField
>
<
telerik:PivotGridAggregateField
DataField
=
"Variance"
Aggregate
=
"Sum"
CellStyle-Width
=
"90px"
DataFormatString
=
"{0:N2}"
>
</
telerik:PivotGridAggregateField
>
<
telerik:PivotGridAggregateField
DataField
=
"Var"
Aggregate
=
"Sum"
CellStyle-Width
=
"90px"
DataFormatString
=
"{0:N2}%"
>
</
telerik:PivotGridAggregateField
>
</
Fields
>
</
telerik:RadPivotGrid
>
Custom Data Calculations functionality of RadPivotGrid will allow you to easily to accomplish the requirement that you have. An online demo which shows such calculations is available in the link below:
http://demos.telerik.com/aspnet-ajax/pivotgrid/examples/calculations/defaultcs.aspx?isNew=true
Regards,
Pavlina
Telerik

Hi Pavlina,
Thanks for your Response,
I tried the custom data calculation demo provided above still am not able to achieve the functionality.if you provide the sample code
snippet that will be help full.Below is the celldatabound event getting used.
Attached the screenshot explained the required scenario
protected void RPG_Variance_CellDataBound(object sender, PivotGridCellDataBoundEventArgs e)
{
if (e.Cell is PivotGridColumnHeaderCell)
{
PivotGridColumnHeaderCell cell = e.Cell as PivotGridColumnHeaderCell;
cell.HorizontalAlign = HorizontalAlign.Center;
cell.Wrap = true;
}
if (e.Cell is PivotGridColumnHeaderCell)
{
if (e.Cell.Text.Contains("Sum of "))
{
e.Cell.Text = e.Cell.Text.Replace("Sum of ", "");
}
}
if (e.Cell is PivotGridDataCell)
{
PivotGridDataCell cell = e.Cell as PivotGridDataCell;
if (cell.CellType == PivotGridDataCellType.DataCell)
{
if ((cell.Field as PivotGridAggregateField).DataField != "Var")
{
if (cell.ParentRowIndexes[0].ToString() == "Oil (Bbl)" || cell.ParentRowIndexes[0].ToString() == "Gas (Mcfd)" || cell.ParentRowIndexes[0].ToString() == "Liquids (Gal)")
{
e.Cell.Text = String.Format("{0:N0}", Double.Parse(e.Cell.Text.Replace("$", "")));
}
else if (cell.ParentRowIndexes[0].ToString() == "Oil Price $/bbl" || cell.ParentRowIndexes[0].ToString() == "Gas Price $/MCF" || cell.ParentRowIndexes[0].ToString() == "NGL Price $/Gal")
{
e.Cell.Style.Add("font-weight", "bold");
e.Cell.Text = "$" + String.Format("{0:N2}", Double.Parse(e.Cell.Text.Replace("$", "")));
}
else if (cell.ParentRowIndexes[0].ToString() == "Average Oil Price $/bbl" || cell.ParentRowIndexes[0].ToString() == "Average Gas Price $/MCF" || cell.ParentRowIndexes[0].ToString() == "Average NGL Price $/GAL")
{
e.Cell.Style.Add("font-weight", "bold");
e.Cell.Text = "$" + String.Format("{0:N2}", Double.Parse(e.Cell.Text.Replace("$", "")));
}
else
{
e.Cell.Text = "$" + String.Format("{0:N0}", Double.Parse(e.Cell.Text.Replace("$", "")));
}
}
}
}
}

Hi Pavlina,
Do you have any update on how to apply the Custom data calculations for specific rows.I tried the above link you provided its
not helping much.If you provide some code sample that will be help full.
Thanks
Karthik

Hi Pavlina ,
Below is the code I tried for one row group using your custom data calculations link,
<
telerik:RadPivotGrid
ID
=
"RPG_Variance"
AllowPaging
=
"false"
PageSize
=
"10"
Skin
=
"Metro"
Height
=
"525px"
RowGroupsDefaultExpanded
=
"false"
TotalsSettings-RowsSubTotalsPosition
=
"First"
RowTableLayout
=
"Outline"
AccessibilitySettings-ColumnHeaderTableCaption
=
""
TotalsSettings-ColumnGrandTotalsPosition
=
"None"
TotalsSettings-RowGrandTotalsPosition
=
"None"
OnCellDataBound
=
"RPG_Variance_CellDataBound"
AllowFiltering
=
"false"
ShowFilterHeaderZone
=
"false"
OnNeedDataSource
=
"RPG_Variance_NeedDataSource"
OnItemNeedCalculation
=
"RPG_Variance_ItemNeedCalculation"
ShowDataHeaderZone
=
"false"
runat
=
"server"
ShowColumnHeaderZone
=
"false"
>
<
ClientSettings
EnableFieldsDragDrop
=
"false"
>
<
Scrolling
AllowVerticalScroll
=
"true"
ScrollHeight
=
"525px"
SaveScrollPosition
=
"true"
></
Scrolling
>
</
ClientSettings
>
<
Fields
>
<
telerik:PivotGridRowField
DataField
=
"Category"
CellStyle-Width
=
"200px"
SortOrder
=
"None"
CellStyle-Height
=
"20px"
>
<
CalculatedItems
>
<
telerik:PivotGridCalculatedItem
GroupName
=
"Oil Price $/bbl"
></
telerik:PivotGridCalculatedItem
>
</
CalculatedItems
>
</
telerik:PivotGridRowField
>
<
telerik:PivotGridRowField
DataField
=
"Budget"
CellStyle-Width
=
"200px"
SortOrder
=
"None"
>
</
telerik:PivotGridRowField
>
<
telerik:PivotGridColumnField
DataField
=
"MonthDate"
CellStyle-Width
=
"50px"
SortOrder
=
"None"
>
</
telerik:PivotGridColumnField
>
<
telerik:PivotGridAggregateField
DataField
=
"Original"
Aggregate
=
"Sum"
CellStyle-Width
=
"90px"
CellStyle-Height
=
"20px"
DataFormatString
=
"{0:N2}"
>
</
telerik:PivotGridAggregateField
>
<
telerik:PivotGridAggregateField
DataField
=
"Scenario"
Aggregate
=
"Sum"
CellStyle-Width
=
"90px"
CellStyle-Height
=
"20px"
DataFormatString
=
"{0:N2}"
>
</
telerik:PivotGridAggregateField
>
<
telerik:PivotGridAggregateField
DataField
=
"Variance"
Aggregate
=
"Sum"
CellStyle-Width
=
"90px"
CellStyle-Height
=
"20px"
DataFormatString
=
"{0:N2}"
>
</
telerik:PivotGridAggregateField
>
<
telerik:PivotGridAggregateField
DataField
=
"Var"
Aggregate
=
"Sum"
CellStyle-Width
=
"90px"
CellStyle-Height
=
"20px"
DataFormatString
=
"{0:N2}%"
>
</
telerik:PivotGridAggregateField
>
</
Fields
>
</
telerik:RadPivotGrid
>C#
Could you clarify if the attached code is working as you expected or you encounter any problems? If yes, what are they?
Regards,
Pavlina
Telerik

Hi Pavlina.
Attached code is not working as expected.Not able achieve the result with custom data calculations link.If you provide sample code that will be helpfull.
Thanks
Karthik.A

Hi Pavlina,
Attached code is not working as expected.not able apply the custom data calculations for specific rows.If you provide some sample code that will be help full.
Thanks & regards
Karthik.A