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

Telerik hide PivotGridCalculatedItem programmatically

1 Answer 56 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Sagar
Top achievements
Rank 1
Sagar asked on 26 Feb 2016, 09:20 AM

Hi ,

I want to hide PivotGridCalculatedItem column programmatically on checkbox change event,is there any provision to do so.

 

Thanks,

Sagar Jaunjalkar

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 02 Mar 2016, 06:58 AM
Hello Sagar,

You can use the following approach to achieve this requirement:
protected void Button1_Click(object sender, EventArgs e)
{
    PivotGridColumnField field = RadPivotGrid1.Fields["Year"] as PivotGridColumnField;
    var calItems = field.CalculatedItems.OfType<PivotGridCalculatedItem>();
    PivotGridCalculatedItem item = calItems.Where(x => x.GroupName == "Forecast for 1999").FirstOrDefault();
    field.CalculatedItems.Remove(item);
    RadPivotGrid1.Rebind();
}

The example above is adjusted for this live sample:
http://demos.telerik.com/aspnet-ajax/pivotgrid/examples/calculations/defaultcs.aspx

I hope this will prove helpful.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
PivotGrid
Asked by
Sagar
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or