Aspose.Cells.GridWeb.Examples.CSharp.Miscellaneous.PivotTable.ApplyPivotFieldFunction.ddlSummary_SelectedIndexChanged C# (CSharp) Method

ddlSummary_SelectedIndexChanged() protected method

protected ddlSummary_SelectedIndexChanged ( object sender, System e ) : void
sender object
e System
return void
        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();
        }