menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridModelDataBinder - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class GridModelDataBinder

    This is a helper class for the GridDataBoundGrid that manages access to the data source.

    Inheritance
    System.Object
    NonFinalizeDisposable
    GridModelDataBinder
    Implements
    System.IDisposable
    IGridModelDataProvider
    ICurrencyManagerSource
    Inherited Members
    NonFinalizeDisposable.Dispose()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Windows.Forms.Grid
    Assembly: Syncfusion.Grid.Windows.dll
    Syntax
    public class GridModelDataBinder : NonFinalizeDisposable, IDisposable, IGridModelDataProvider, ICurrencyManagerSource
    Remarks

    GridDataBoundGrid implements the IGridModelDataProvider interface that lets it catch QueryRowCount, QueryColCount, QueryCellInfo, and SaveCellInfo events in one place.

    The methods in this interface are called before the named events are raised and thus give you a chance to control the event's behavior before other subscribers can handle it.

    You access the GridModelDataBinder instance with the DataProvider property of the GridModel.

    Constructors

    GridModelDataBinder(GridModel)

    Initializes a new GridModelDataBinder and associates it with a GridModel.

    Declaration
    public GridModelDataBinder(GridModel model)
    Parameters
    Type Name Description
    GridModel model

    The GridModelthis object should be associated with.

    Fields

    childListHandler

    Used internally.

    Declaration
    public GridModelDataBinder.GetChildListHandler childListHandler
    Field Value
    Type
    GridModelDataBinder.GetChildListHandler

    Properties

    AddNewForceItemChangedEventHack

    Gets or sets a value indicating whether add new ForceItemChangedEvent hack. Used internally.

    Declaration
    public static bool AddNewForceItemChangedEventHack { get; set; }
    Property Value
    Type
    System.Boolean

    AllowAddNew

    Gets a value indicating whether a datasource supports adding new records.

    Declaration
    public bool AllowAddNew { get; }
    Property Value
    Type
    System.Boolean

    AllowEdit

    Gets a value indicating whether a datasource supports editing records.

    Declaration
    public bool AllowEdit { get; }
    Property Value
    Type
    System.Boolean

    AllowRemove

    Gets a value indicating whether the datasource allows removing records.

    Declaration
    public bool AllowRemove { get; }
    Property Value
    Type
    System.Boolean

    AllowSetValueOnCurrentItem

    Gets or sets a value indicating whether the datasource is a DataView and the user edits the contents of a cell in the current record, the value will also be set in the underlying record. If this is a problem for, e.g. if you want to be able to modify contents of the current record from outside after it was switched into edit mode, you can set this AllowSetValueOnCurrentItem to false.

    Declaration
    public bool AllowSetValueOnCurrentItem { get; set; }
    Property Value
    Type
    System.Boolean

    AutoInitCellTypes

    Gets or sets a value indicating whether the grid should set CellType automatically for columns that have dates or Boolean values.

    Declaration
    public static bool AutoInitCellTypes { get; set; }
    Property Value
    Type
    System.Boolean

    BindingContext

    Gets or sets the BindingContext for this object. You can assign a BindingContext from a parent form to this property.

    Declaration
    public BindingContext BindingContext { get; set; }
    Property Value
    Type
    System.Windows.Forms.BindingContext

    BindToCurrencyManager

    Gets or sets a value indicating whether list should be attached to System.Windows.Forms.CurrencyManager or if you would like the engine to be detached from a CurrencyManager. (Default is True)

    Declaration
    public bool BindToCurrencyManager { get; set; }
    Property Value
    Type
    System.Boolean

    BoundColumnsCollectionType

    Gets or sets if you want to use a class derived from GridBoundColumn, you should also derive a GridBoundColumnsCollection and set BoundColumnsCollectionType.

    Declaration
    public static Type BoundColumnsCollectionType { get; set; }
    Property Value
    Type
    System.Type
    Examples

    This sample demonstrates how to implement a derived CustomGridColumn:

    
        /// 
        /// A specialization of the GridBoundColumn class with additional
        /// functionality.
        /// 
        public class CustomGridColumn : GridBoundColumn, ICloneable
        {
           private int width;
           private int widthPercentage;
    

    ///

    /// Default constructor. /// public CustomGridColumn() { }

    public int Width { get { return width; } set { width = value; } }

    public int WidthPercentage { get { return widthPercentage; } set { widthPercentage = value; } }

    public CustomGridColumn(PropertyDescriptor prop) : base(prop) { }

    object ICloneable.Clone() { return base.Clone(); }

    }

    [ListBindableAttribute(false)] [Editor(typeof(GridBoundColumnsCollectionEditor), typeof(System.Drawing.Design.UITypeEditor))] public class CustomGridColumnsCollection : GridBoundColumnsCollection, ICloneable { public CustomGridColumnsCollection(GridModelDataBinder table) : base(table) { }

    public override GridBoundColumn CreateBoundColumn(PropertyDescriptor pd) { return new CustomGridColumn(pd); }

    ///

    /// Creates a new CustomGridColumnsCollection and creates copies of all members in this collection. /// /// A CustomGridColumnsCollection object. public override object Clone() { GridModelDataBinder owner = null; owner = this.Owner as GridModelDataBinder; CustomGridColumnsCollection clone = new CustomGridColumnsCollection(owner); foreach (GridBoundColumn item in this) clone.Add((GridBoundColumn) item); //.Clone()); return clone; }

    /// /// Gets a specified CustomGridColumn in the CustomGridColumnsCollection. /// ///

    /// Gets a specified CustomGridColumn in the CustomGridColumnsCollection. /// public new CustomGridColumn this[int index] { get { return (CustomGridColumn) base[index]; } }

    ///

    /// Gets a specified CustomGridColumn in the CustomGridColumnsCollection. /// public new CustomGridColumn this[string columnName] { get { return (CustomGridColumn) base[columnName]; } }

    ///

    /// Gets a specified CustomGridColumn in the CustomGridColumnsCollection. /// public new CustomGridColumn this[PropertyDescriptor propDesc] { get { return (CustomGridColumn) base[propDesc]; } } }

    
        public class SyncFusionBoundGrid : GridDataBoundGrid
        {
           /// 
           /// Default constructor.
           /// 
            public SyncFusionBoundGrid() : base()
           {
                GridModelDataBinder.BoundColumnsCollectionType = typeof(CustomGridColumnsCollection);
           }
    

    ///

    /// A collection of grid bound columns. This property is overridden so /// that the type used to define a grid bound column is a specialized /// version. /// [ Browsable(false), DesignerSerializationVisibilityAttribute( DesignerSerializationVisibility.Hidden ) ] public override GridBoundColumnsCollection GridBoundColumns { get { return base.GridBoundColumns; } set {

    base.GridBoundColumns = value; } }

    ///

    /// A collection of grid bound columns. This property is overridden so /// that the type used to define a grid bound column is a specialized /// version. /// [ DesignerSerializationVisibilityAttribute( DesignerSerializationVisibility.Content ) ] [ LocalizableAttribute(true) ] [ Description( "Manages the columns to be displayed in the GridDataBoundGrid." ) ] [ Category( "Data" ) ] [ RefreshProperties( RefreshProperties.All ) ] [ Editor( typeof(GridBoundColumnsCollectionEditor), typeof(UITypeEditor) ) ] public CustomGridColumnsCollection CustomGridColumns { get { return base.GridBoundColumns as CustomGridColumnsCollection; } set {

    base.GridBoundColumns = value; } } }

    CurrentPosition

    Gets or sets the zero-based position of the current record in the datasource.

    Declaration
    public int CurrentPosition { get; set; }
    Property Value
    Type
    System.Int32

    CurrentRowIndex

    Gets the row index in the grid for the CurrentPosition.

    Declaration
    public int CurrentRowIndex { get; }
    Property Value
    Type
    System.Int32

    DataMember

    Gets or sets the specific list in a DataSource for which the GridDataBoundGrid control displays a gridModel.

    Declaration
    public string DataMember { get; set; }
    Property Value
    Type
    System.String

    DataSource

    Gets or sets the datasource that the gridModel is displaying data for.

    Declaration
    public object DataSource { get; set; }
    Property Value
    Type
    System.Object

    DefaultCurrentRecordItemChangedBehavior

    Gets or sets the default behavior when the grid is notified from the underlying IBindingList that the data for the current record are changed.

    Declaration
    public GridCurrentRecordItemChangedBehavior DefaultCurrentRecordItemChangedBehavior { get; set; }
    Property Value
    Type
    GridCurrentRecordItemChangedBehavior

    DirectSaveCellInfo

    Gets or sets a value indicating whether to save cell values directly into the datasource without moving the current record and without calling BeginEdit or EndEdit.

    Declaration
    public bool DirectSaveCellInfo { get; set; }
    Property Value
    Type
    System.Boolean
    Remarks

    The clipboard paste and clipboard deleted functions temporarily raise this flag when pasting several rows.

    DoNotDisposeLists

    Gets or sets a value indicating whether DoNotDisposeLists. Used internally.

    Declaration
    public static bool DoNotDisposeLists { get; set; }
    Property Value
    Type
    System.Boolean

    EnableAddNew

    Gets or sets a value indicating whether the grid supports editing records if the underlying datasource allows it. See AllowAddNew.

    Declaration
    public bool EnableAddNew { get; set; }
    Property Value
    Type
    System.Boolean

    EnableEdit

    Gets or sets a value indicating whether the grid supports editing records if the underlying datasource allows it. See AllowEdit.

    Declaration
    public bool EnableEdit { get; set; }
    Property Value
    Type
    System.Boolean

    EnableRemove

    Gets or sets a value indicating whether the grid supports removing records if the underlying datasource allows it. See AllowRemove.

    Declaration
    public bool EnableRemove { get; set; }
    Property Value
    Type
    System.Boolean

    ErrorMessage

    Gets the error message of the last error.

    Declaration
    public string ErrorMessage { get; }
    Property Value
    Type
    System.String

    Exception

    Gets the exception for the last save operation.

    Declaration
    public Exception Exception { get; }
    Property Value
    Type
    System.Exception

    ForceUpdateAfterListChangedEvent

    Gets or sets a value indicating whether ForceUpdateAfterListChangedEvent. Used internally.

    Declaration
    public bool ForceUpdateAfterListChangedEvent { get; set; }
    Property Value
    Type
    System.Boolean

    GridBoundColumns

    Gets or sets a collection of GridBoundColumn objects in the GridDataBoundGrid control.

    Declaration
    public GridBoundColumnsCollection GridBoundColumns { get; set; }
    Property Value
    Type
    GridBoundColumnsCollection

    HasError

    Gets a value indicating whether an error occurred in the last save operation.

    Declaration
    public bool HasError { get; }
    Property Value
    Type
    System.Boolean

    HierarchyLevelCount

    Gets the number of hierarchies displayed in this grid. A regular data source without nested relations will have a HierarchyLevelCount of 1.

    Declaration
    public int HierarchyLevelCount { get; }
    Property Value
    Type
    System.Int32

    InEndEdit

    Gets a value indicating whether EndEdit() has been called.

    Declaration
    public bool InEndEdit { get; }
    Property Value
    Type
    System.Boolean

    InRowChanged

    Gets a value indicating whether in row changed. True while in OnRowChanged(EventArgs).

    Declaration
    public bool InRowChanged { get; }
    Property Value
    Type
    System.Boolean

    IsAddNew

    Gets a value indicating whether AddNew() has been called.

    Declaration
    public bool IsAddNew { get; }
    Property Value
    Type
    System.Boolean

    IsAppendRow

    Gets a value indicating whether the grid's current row is positioned at the append row (if any).

    Declaration
    public bool IsAppendRow { get; }
    Property Value
    Type
    System.Boolean

    IsDesignMode

    Gets or sets a value indicating whether is design mode. True if component is designed inside a designer; False otherwise.

    Declaration
    public bool IsDesignMode { get; set; }
    Property Value
    Type
    System.Boolean

    IsDirty

    Gets a value indicating whether there are pending changes to the current record.

    Declaration
    public bool IsDirty { get; }
    Property Value
    Type
    System.Boolean

    IsEditing

    Gets a value indicating whether BeginEdit() has been called.

    Declaration
    public bool IsEditing { get; }
    Property Value
    Type
    System.Boolean

    IsSuspendBinding

    Gets a value indicating whether SuspendBinding() was called.

    Declaration
    public bool IsSuspendBinding { get; }
    Property Value
    Type
    System.Boolean
    Remarks

    SuspendBinding() and ResumeBinding() are two methods that allow the temporary suspension and resumption of data binding. You would typically suspend data binding if you want to make several changes to the datasource without immediately updating the grid after each change.

    For example, if you want to clear out all the records in your data set and refill it with its original data, you can improve performance of this operation substantially if the grid does not need to immediately reflect every row change while the data set is filled.

    OptimizeListChangedEvent

    Gets or sets a value indicating whether OptimizeListChangedEvent. Used internally.

    Declaration
    public bool OptimizeListChangedEvent { get; set; }
    Property Value
    Type
    System.Boolean

    RecordCount

    Gets the number of records in the datasource. If you are displaying a grid with nested relations, the only the record count for the root data source is displayed ignoring any expanded nodes.

    Declaration
    public int RecordCount { get; }
    Property Value
    Type
    System.Int32

    RelationCount

    Gets the number of relations displayed in the grid.

    Declaration
    public int RelationCount { get; }
    Property Value
    Type
    System.Int32

    RootHierarchyLevel

    Gets the GridHierarchyLevel with information about columns displayed for the root list.

    Declaration
    public GridHierarchyLevel RootHierarchyLevel { get; }
    Property Value
    Type
    GridHierarchyLevel

    SavedPosition

    Gets the last position before CurrentPosition was changed.

    Declaration
    public int SavedPosition { get; }
    Property Value
    Type
    System.Int32

    SavedRowIndex

    Gets the row index in the grid for the SavedPosition.

    Declaration
    public int SavedRowIndex { get; }
    Property Value
    Type
    System.Int32

    Site

    Gets or sets Property Site (ISite)

    Declaration
    public ISite Site { get; set; }
    Property Value
    Type
    System.ComponentModel.ISite

    SupportsAddNew

    Gets a value indicating whether to support add new. Use AllowAddNew instead.

    Declaration
    public bool SupportsAddNew { get; }
    Property Value
    Type
    System.Boolean

    Methods

    AddNew()

    Adds a new record to the datasource.

    Declaration
    public virtual void AddNew()

    AddRelation(String)

    Adds a GridHierarchyLevel to the grid for a specified relation. If you are referring to a relation within a System.Data.DataSet, the name of the relation should be the same name you used when adding the relation to System.Data.DataSet.Relations of System.Data.DataSet.

    Declaration
    public GridHierarchyLevel AddRelation(string nestedDataMember)
    Parameters
    Type Name Description
    System.String nestedDataMember

    The name of the relation. This can be the name of a System.Data.DataRelation or the name of a System.ComponentModel.PropertyDescriptor that references any System.Collections.IList.

    Returns
    Type Description
    GridHierarchyLevel

    The GridHierarchyLevel with information about columns displayed for the newly added relation.

    BeginEdit()

    Begins an edit on the current record.

    Declaration
    public virtual void BeginEdit()

    CancelEdit()

    Cancels the current edit operation.

    Declaration
    public virtual void CancelEdit()

    ColIndexToField(Int32)

    Converts a column index in a grid to a zero-based field number adjusted for column headers. The resulting field number can be used as an index to look up a GridBoundColumn in the Syncfusion.Windows.Forms.Grid.GridModelDataBinder.InternalColumns collection.

    Declaration
    public int ColIndexToField(int colIndex)
    Parameters
    Type Name Description
    System.Int32 colIndex

    The column index in the grid.

    Returns
    Type Description
    System.Int32

    A zero-based field number in the datasource.

    CreateBoundColumnsCollection()

    Instantiates a GridBoundColumnsCollection that holds the collection of GridBoundColumn objects. If you want to use a class derived from the GridBoundColumn you should also derive a GridBoundColumnsCollection and set BoundColumnsCollectionType. See BoundColumnsCollectionType for a sample.

    Declaration
    public virtual GridBoundColumnsCollection CreateBoundColumnsCollection()
    Returns
    Type Description
    GridBoundColumnsCollection

    An empty GridBoundColumnsCollection.

    Dispose(Boolean)

    Releases all resources used by the System.ComponentModel.Component.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    true to release both managed and unmanaged resources; false to release only unmanaged resources.

    Overrides
    NonFinalizeDisposable.Dispose(Boolean)
    Remarks

    See the documentation for the System.ComponentModel.Component class and its Dispose member.

    EndEdit()

    Pushes changes since a BeginEdit() call for the current record.

    Declaration
    public virtual void EndEdit()

    FieldToColIndex(Int32)

    Converts a zero-based field number to a column index in a grid adjusted for column headers.

    Declaration
    public int FieldToColIndex(int fieldNum)
    Parameters
    Type Name Description
    System.Int32 fieldNum

    A zero-based field number in the datasource.

    Returns
    Type Description
    System.Int32

    The column index in the grid.

    GetHierarchyLevel(Int32)

    Returns the GridHierarchyLevel with information about columns displayed for the specified relation.

    Declaration
    public GridHierarchyLevel GetHierarchyLevel(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The zero-based hierarchy level for this relation.

    Returns
    Type Description
    GridHierarchyLevel

    The GridHierarchyLevel with information about columns displayed for the specified relation.

    GetHierarchyLevel(String)

    Returns the GridHierarchyLevel with information about columns displayed for the specified relation.

    Declaration
    public GridHierarchyLevel GetHierarchyLevel(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the relation. This should be the same name you used for adding the relation with AddRelation(String).

    Returns
    Type Description
    GridHierarchyLevel

    The GridHierarchyLevel with information about columns displayed for the specified relation.

    GetRecordStateAtRowIndex(Int32)

    Returns the GridBoundRecordState for the specified absolute row index with information about the hierarchy level and the record displayed at the specified row.

    Declaration
    public GridBoundRecordState GetRecordStateAtRowIndex(int rowIndex)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    The absolute row index in the grid.

    Returns
    Type Description
    GridBoundRecordState

    A GridBoundRecordState with information about the hierarchy level and the record displayed at the specified row.

    InitializeColumns()

    Recreates the internal columns collection or loops through the existing GridBoundColumns collection and reinitializes columns with the correct PropertyDescriptor based on the MappingName.

    Declaration
    public void InitializeColumns()
    Remarks

    This method is automatically called when a DataSource is assigned to the grid.

    IsAnyDirtyField()

    Checks if any field in the current record is modified.

    Declaration
    public bool IsAnyDirtyField()
    Returns
    Type Description
    System.Boolean

    true if there are pending changes; false if current record is not modified.

    IsFieldDirty(Int32)

    Checks if a field is modified in the current record.

    Declaration
    public bool IsFieldDirty(int fieldNum)
    Parameters
    Type Name Description
    System.Int32 fieldNum

    The zero-based field index.

    Returns
    Type Description
    System.Boolean

    True if field is changed; False otherwise.

    LayoutColumns(String[])

    Rearranges how columns are displayed in the grid and allows you to specify covered cells and / or break records into several rows displayed in the grid.

    Declaration
    public void LayoutColumns(params string[] mappingNames)
    Parameters
    Type Name Description
    System.String[] mappingNames

    A string array with field names.

    The following strings have a specific meaning:

    "-" specifies a covered cell.

    "." indicates line break inside the record. Subsequent fields will be displayed in another row.

    "" specifies an empty "whitespace" column.

    Other that these, you should use the same mapping names that you also use with GridBoundColumn objects.

    Examples

    See the "MultiRowRecord" and "ExpandGrid" examples for sample code.

    ListManagerPositionToRowIndex(Int32)

    Converts a zero-based position of the data source displayed in the grid to an absolute row index in the grid.

    Declaration
    public int ListManagerPositionToRowIndex(int record)
    Parameters
    Type Name Description
    System.Int32 record

    A zero-based record in the data source displayed in the grid.

    Returns
    Type Description
    System.Int32

    The row index in the grid.

    Remarks

    The returned value depends on the number of rows per record and the current expansion state of hierarchy levels in the grid.

    Only the list manager position for the outer hierarchy is accepted as input.

    NameToColIndex(String)

    Returns the column index for a column that matches a given name. Returns the zero-based field number for a column that matches a given name. The resulting field number can be used as an index for Item[Int32, Int32].

    Declaration
    public int NameToColIndex(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the field to be matched.

    Returns
    Type Description
    System.Int32

    The column index in the grid; -1 if not found.

    Remarks

    This function only searches the columns in the root level. If you have several relations displayed in the grid, the nested relations will not be searched by this function.

    NameToField(String)

    Returns the zero-based field number for a column that matches a given name. The resulting field number can be used as an index to look up a GridBoundColumn in the Syncfusion.Windows.Forms.Grid.GridModelDataBinder.InternalColumns collection.

    Declaration
    public int NameToField(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the field to be matched.

    Returns
    Type Description
    System.Int32

    A zero-based field number in the datasource; -1 if not found.

    Remarks

    This function only searches the columns in the root level. If you have several relations displayed in the grid, the nested relations will not be searched by this function.

    NameToRowIndex(String)

    Returns the row index for a row that matches a given name.

    Declaration
    public int NameToRowIndex(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the row to be matched.

    Returns
    Type Description
    System.Int32

    The row index in the grid; -1 if not found.

    OnBindingContextChanged(EventArgs)

    This is called when the BindingContext property is changed.

    Declaration
    protected virtual void OnBindingContextChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    The System.EventArgsthat contains event data.

    OnBindingListChanged(ListChangedEventArgs)

    Raises the BindingListChanged event.

    Declaration
    protected virtual void OnBindingListChanged(ListChangedEventArgs e)
    Parameters
    Type Name Description
    System.ComponentModel.ListChangedEventArgs e

    A System.ComponentModel.ListChangedEventArgs that contains the event data.

    OnCurrentCellListItemChanged(GridCurrentCellListItemChangedEventArgs)

    Occurs when the grid is notified from the underlying IBindingList and lets you dynamically define the behavior how to resolve conflict with pending changes in current record.

    Declaration
    protected virtual void OnCurrentCellListItemChanged(GridCurrentCellListItemChangedEventArgs e)
    Parameters
    Type Name Description
    GridCurrentCellListItemChangedEventArgs e

    OnCurrentPositionChanged(EventArgs)

    Raises the CurrentPositionChanged event.

    Declaration
    protected virtual void OnCurrentPositionChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    An Systems.Windows.EventArgs that contains the event data.

    OnDataSourceChanged(EventArgs)

    Raises the DataSourceChanged event.

    Declaration
    protected virtual void OnDataSourceChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    An Systems:EventArgs that contains the event data.

    OnEditModeChanged(EventArgs)

    Raises the EditModeChanged event.

    Declaration
    protected virtual void OnEditModeChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    A Systems.Windows.EventArgs that contains the event data.

    OnGridBoundColumnsChanged(EventArgs)

    Raises the GridBoundColumnsChanged event.

    Declaration
    protected virtual void OnGridBoundColumnsChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    An System.Windows.EventArgs that contains the event data.

    OnItemChanged(ItemChangedEventArgs)

    Raises the ItemChanged event.

    Declaration
    protected virtual void OnItemChanged(ItemChangedEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.ItemChangedEventArgs e

    An System.Windows.Forms.ItemChangedEventArgs that contains the event data.

    OnRecordsRemoved(EventArgs)

    Raises the RecordsRemoved event.

    Declaration
    protected virtual void OnRecordsRemoved(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    An Systems:EventArgs that contains the event data.

    OnRowChanged(EventArgs)

    Raises the RowChanged event.

    Declaration
    protected virtual void OnRowChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    The System.EventArgsthat contains event data.

    PositionToRowIndex(Int32)

    Converts a zero-based position in the grid to an absolute row index in the grid.

    Declaration
    public int PositionToRowIndex(int gridPosition)
    Parameters
    Type Name Description
    System.Int32 gridPosition

    A zero-based position in the grid. The first position is the 0-based index starting with the first non-header row in the grid.

    Returns
    Type Description
    System.Int32

    The row index in the grid.

    Remarks

    If you have a grid with 3 row headers:

    PositionToRowIndex(-1) will throw exception.

    PositionToRowIndex(0) will return 3.

    PositionToRowIndex(1) will return 4.

    QueryCellInfo(GridQueryCellInfoEventArgs)

    Method handler for the QueryCellInfo event.

    Declaration
    protected virtual void QueryCellInfo(GridQueryCellInfoEventArgs e)
    Parameters
    Type Name Description
    GridQueryCellInfoEventArgs e

    An GridQueryCellInfoEventArgs that contains the event data.

    QueryColCount(GridRowColCountEventArgs)

    Method handler for the QueryColCount event.

    Declaration
    protected virtual void QueryColCount(GridRowColCountEventArgs e)
    Parameters
    Type Name Description
    GridRowColCountEventArgs e

    An GridRowColCountEventArgs that contains the event data.

    QueryRowCount(GridRowColCountEventArgs)

    Method handler for the QueryRowCount event.

    Declaration
    protected virtual void QueryRowCount(GridRowColCountEventArgs e)
    Parameters
    Type Name Description
    GridRowColCountEventArgs e

    An GridRowColCountEventArgs that contains the event data.

    RaiseCurrentPositionChanged()

    Raises a CurrentPositionChanged event.

    Declaration
    public void RaiseCurrentPositionChanged()

    RecordEqualsAtRowIndex(Int32, Int32)

    Checks if both rows represent the same record of the underlying data source.

    Declaration
    public bool RecordEqualsAtRowIndex(int rowIndex1, int rowIndex2)
    Parameters
    Type Name Description
    System.Int32 rowIndex1

    The first row index.

    System.Int32 rowIndex2

    The second row index.

    Returns
    Type Description
    System.Boolean

    True if both rows show the same record of the underlying data source.

    Remarks

    Normally different rows will represent different records in the data source. However, you can break one record into several rows with LayoutColumns(String[]). In that case, several rows can represent the same record in the datasource.

    RemoveRecords(Int32, Int32)

    Removes the specified records from the datasource (without sending a RowsDeleting event; use DeleteRecordsAtRowIndex(Int32, Int32) instead if you need it.

    Declaration
    public virtual void RemoveRecords(int first, int last)
    Parameters
    Type Name Description
    System.Int32 first

    The zero-based position of the first record.

    System.Int32 last

    The zero-based position of the last record.

    ResetError()

    Resets error information for the current record.

    Declaration
    public void ResetError()

    ResetField(Int32)

    Resets a field back to its original value in the current record.

    Declaration
    public void ResetField(int fieldNum)
    Parameters
    Type Name Description
    System.Int32 fieldNum

    The zero-based field index.

    ResetHierarchyLevels()

    Call this if you have changed the underlying datasource and added several relations.

    Declaration
    public void ResetHierarchyLevels()

    ResumeBinding()

    Resumes data binding after a previous SuspendBinding() call.

    Declaration
    public void ResumeBinding()
    Remarks

    SuspendBinding() and ResumeBinding() are two methods that allow the temporary suspension and resumption of data binding. You would typically suspend data binding if you want to make several changes to the data source without immediately updating the grid after each change.

    For example, if you want to clear out all records in your data set and refill it with its original data, you can improve performance of this operation substantially if the grid does not need to immediately reflect every row change while the data set is filled.

    RowIndexToListManagerPosition(Int32)

    Converts an absolute row index in a grid to a zero-based record index of the datasource displayed in the grid.

    Declaration
    public int RowIndexToListManagerPosition(int rowIndex)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    The absolute row index in the grid.

    Returns
    Type Description
    System.Int32

    Zero-based record index of the data source displayed in the grid.

    Remarks

    The returned value depends on the number of rows per record and the current expansion state of hierarchy levels in the grid.

    Only the list manager position for the outer hierarchy is returned.

    RowIndexToPosition(Int32)

    Converts an absolute row index in a grid to a zero-based position in the same grid adjusted for row headers. The first grid position is the 0-based index starting with the first non-header row in the grid.

    Declaration
    public int RowIndexToPosition(int rowIndex)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    The absolute row index in the grid.

    Returns
    Type Description
    System.Int32

    The zero-based position in the grid adjusted for row headers.

    Remarks

    If you have a grid with 3 row headers:

    RowIndexToPosition(4) will return 1.

    RowIndexToPosition(3) will return 0.

    RowIndexToPosition(2) will return -1.

    RowIndexToPosition(1) will return -1.

    The row index and the grid position do not depend on RelationCount and number of rows per record.

    SaveCellInfo(GridSaveCellInfoEventArgs)

    Method handler for the SaveCellInfo event.

    Declaration
    protected virtual void SaveCellInfo(GridSaveCellInfoEventArgs e)
    Parameters
    Type Name Description
    GridSaveCellInfoEventArgs e

    An GridSaveCellInfoEventArgs that contains the event data.

    SetCurrentPosition(Int32, Boolean)

    Changes the current record in the datasource.

    Declaration
    public void SetCurrentPosition(int value, bool raiseCurrentPositionChanged)
    Parameters
    Type Name Description
    System.Int32 value

    The zero-based position in the datasource for the new current record.

    System.Boolean raiseCurrentPositionChanged

    specifies if a CurrentPositionChanged event should be raised.

    SetDataBinding(Object, String)

    Sets the DataSource and DataMember properties at run-time.

    Declaration
    public void SetDataBinding(object dataSource, string dataMember)
    Parameters
    Type Name Description
    System.Object dataSource

    The datasource, typed as System.Object, for the GridDataBoundGrid control.

    System.String dataMember

    The DataMember string that specifies the table to bind to within the object returned by the DataSource property.

    Sort(Int32)

    Sorts the datasource by the specified field.

    Declaration
    public virtual void Sort(int fieldNum)
    Parameters
    Type Name Description
    System.Int32 fieldNum

    This number specifies the field to use as key for a sort.

    Remarks

    When the datasource is sorted by the specified field, the sort direction is toggled between ascending and descending.

    Sorting is supported only for columns displayed in the root level for grid with nested relations displayed in the grid.

    SuspendBinding()

    Suspends data binding until ResumeBinding() is called.

    Declaration
    public void SuspendBinding()
    Remarks

    SuspendBinding() and ResumeBinding() are two methods that allow the temporary suspension and resumption of data binding. You would typically suspend data binding if you want to make several changes to the data source without immediately updating the grid after each change.

    For example, if you want to clear out all records in your data set and refill it with its original data, you can improve performance of this operation substantially if the grid does not need to immediately reflect every row change while the data set is filled.

    Events

    BindingListChanged

    Occurs before the GridModelDataBinder processes the System.ComponentModel.IBindingList.ListChanged event of an attached source list.

    Declaration
    public event ListChangedEventHandler BindingListChanged
    Event Type
    Type
    System.ComponentModel.ListChangedEventHandler
    Remarks

    The reason for firing this event is to give a programmer chance to react to a System.ComponentModel.IBindingList.ListChanged event before the binder since there is otherwise no order guaranteed when an IBindingList raises a ListChanged event.

    CurrentCellListItemChanged

    Occurs when the grid is notified from the underlying IBindingList and lets you dynamically define the behavior how to resolve conflict with pending changes in current record.

    Declaration
    public event GridCurrentCellListItemChangedEventHandler CurrentCellListItemChanged
    Event Type
    Type
    GridCurrentCellListItemChangedEventHandler

    CurrentPositionChanged

    Occurs when the current record position in the datasource is changed.

    Declaration
    public event EventHandler CurrentPositionChanged
    Event Type
    Type
    System.EventHandler

    DataSourceChanged

    Occurs when the DataSource property has changed.

    Declaration
    public event EventHandler DataSourceChanged
    Event Type
    Type
    System.EventHandler

    EditModeChanged

    Occurs when BeginEdit(), EndEdit(), CancelEdit(), or AddNew() is called.

    Declaration
    public event EventHandler EditModeChanged
    Event Type
    Type
    System.EventHandler

    GridBoundColumnsChanged

    Occurs when columns have been added or removed.

    Declaration
    public event EventHandler GridBoundColumnsChanged
    Event Type
    Type
    System.EventHandler

    ItemChanged

    Occurs when contents of a record have changed.

    Declaration
    public event ItemChangedEventHandler ItemChanged
    Event Type
    Type
    System.Windows.Forms.ItemChangedEventHandler

    RecordsRemoved

    Occurs after records are removed.

    Declaration
    public event EventHandler RecordsRemoved
    Event Type
    Type
    System.EventHandler

    RowChanged

    Occurs when contents of a record have changed.

    Declaration
    public event EventHandler RowChanged
    Event Type
    Type
    System.EventHandler

    Explicit Interface Implementations

    IGridModelDataProvider.QueryCellInfo(GridQueryCellInfoEventArgs)

    Method handler for the QueryCellInfo event.

    Declaration
    void IGridModelDataProvider.QueryCellInfo(GridQueryCellInfoEventArgs e)
    Parameters
    Type Name Description
    GridQueryCellInfoEventArgs e

    The GridQueryCellInfoEventArgsthat contains event data.

    IGridModelDataProvider.QueryColCount(GridRowColCountEventArgs)

    Method handler for the QueryColCount event

    Declaration
    void IGridModelDataProvider.QueryColCount(GridRowColCountEventArgs e)
    Parameters
    Type Name Description
    GridRowColCountEventArgs e

    The GridRowColCountEventArgsthat contains event data.

    IGridModelDataProvider.QueryRowCount(GridRowColCountEventArgs)

    Method handler for the QueryColCount event

    Declaration
    void IGridModelDataProvider.QueryRowCount(GridRowColCountEventArgs e)
    Parameters
    Type Name Description
    GridRowColCountEventArgs e

    The GridRowColCountEventArgsthat contains event data.

    IGridModelDataProvider.SaveCellInfo(GridSaveCellInfoEventArgs)

    Method handler for the SaveCellInfo event.

    Declaration
    void IGridModelDataProvider.SaveCellInfo(GridSaveCellInfoEventArgs e)
    Parameters
    Type Name Description
    GridSaveCellInfoEventArgs e

    An GridSaveCellInfoEventArgs that contains the event data.

    ICurrencyManagerSource.GetCurrencyManager()

    Returns a System.Windows.Forms.CurrencyManager that is associated with the current object.

    Declaration
    CurrencyManager ICurrencyManagerSource.GetCurrencyManager()
    Returns
    Type
    System.Windows.Forms.CurrencyManager

    Implements

    System.IDisposable
    IGridModelDataProvider
    ICurrencyManagerSource
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved