Skip to main content

PivotDrillDownDataSource.SetValue(Int32, PivotGridFieldBase, Object) Method

Sets the value of the specified data field in the specified row.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.PivotGrid.v23.2.Core.dll

NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.Win.Navigation

Declaration

public abstract void SetValue(
    int rowIndex,
    PivotGridFieldBase field,
    object value
)

Parameters

Name Type Description
rowIndex Int32

A zero-based integer that identifies the data row.

field PivotGridFieldBase

A PivotGridFieldBase object that represents the pivot grid field. It’s PivotGridFieldBase.FieldName property identifies the column in the data source.

value Object

An object that represents the new value.

Remarks

If the PivotGrid control is bound to an OLAP cube, data editing is not allowed. In this instance, the SetValue method throws an exception.

Note

The SetValue method is not in effect for unbound columns.

Example

To edit strings in PivotGridControl, summaries should be turned off. In this example, the PivotGridField.SummaryTypeproperty is set to Minfor the data field.

using System.Data;
using System.Windows.Forms;
using DevExpress.XtraPivotGrid;

namespace PivotGridEditor {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();

            DataTable data = new DataTable();
            data.Columns.Add("row", typeof(string));
            data.Columns.Add("data", typeof(string));
            data.Rows.Add("1", "aaa");
            data.Rows.Add("2", "bbb");
            data.Rows.Add("3", "ccc");
            data.Rows.Add("4", "ddd");
            pivotGridControl1.DataSource = data.DefaultView;
        }

        private void pivotGridControl1_EditValueChanged(object sender, EditValueChangedEventArgs e) {
            PivotDrillDownDataSource ds = e.CreateDrillDownDataSource();
            ds.SetValue(0, "data", e.Editor.EditValue);
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SetValue(Int32, PivotGridFieldBase, Object) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also