protected void ddlSummary_SelectedIndexChanged(object sender, System.EventArgs e)
{
// Create pivot table object against selected dropdownlist value
GridWorksheet sheet = GridWeb1.WorkSheets["PivotTable Report"];
GridPivotTable pivotTable = sheet.PivotTables[0];
// Bind pivot table
pivotTable.Fields(GridPivotFieldType.Data)[0].Function =
(GridPivotFieldFunction)TypeDescriptor.GetConverter
(typeof(GridPivotFieldFunction)).ConvertFrom
(ddlSummary.SelectedItem.Value);
// Paints PivotTable report
pivotTable.CalculateData();
}