New to Telerik UI for WinFormsStart a free 30-day trial

Represents the master template for RadGridView that provides the core functionality for data display, hierarchical relationships, selection management, and event synchronization across the entire grid structure.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.GridView.dll

Syntax:

C#
public class MasterGridViewTemplate : GridViewTemplate, IComponent, IDisposable, IDataItemSource, IHierarchicalRow, INotifyPropertyChangingEx, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IGridViewEventListener

Inheritance: objectMarshalByRefObjectComponentGridViewTemplateMasterGridViewTemplate

Implements: IComponentIDataItemSourceIDisposableIGridViewEventListenerIHierarchicalRowINotifyPropertyChangedINotifyPropertyChangingExISupportInitializeISupportInitializeNotification...

Inherited Members GridViewTemplate.OnCreateRowInfo(GridViewCreateRowInfoEventArgs)GridViewTemplate.ProcessColumnPropertyChangedEvent(GridViewColumn, RadPropertyChangedEventArgs)GridViewTemplate.DispatchEvent(GridViewEvent)GridViewTemplate.SuspendEvent(KnownEvents)GridViewTemplate.ResumeEvent(KnownEvents)GridViewTemplate.DispatchEvent(GridViewEvent, bool)GridViewTemplate.OnBindingContextChanged(EventArgs)GridViewTemplate.OnPropertyChanging(string)GridViewTemplate.OnPropertyChanging(PropertyChangingEventArgsEx)GridViewTemplate.OnNotifyPropertyChanged(string)GridViewTemplate.SetProperty<T>(string, ref T, T)GridViewTemplate.BeginInit()GridViewTemplate.ResetCurrentColumn()GridViewTemplate.OnViewChanged(DataViewChangedEventArgs)GridViewTemplate.ClearAllSummariesFromGroups()GridViewTemplate.SetEnableAlternatingRowColor(bool)GridViewTemplate.EnsureHierarchyProvider()GridViewTemplate.EnsureRowType(GridViewTemplate)GridViewTemplate.DeferRefresh()GridViewTemplate.SetError(GridViewCellCancelEventArgs, string)GridViewTemplate.SetError(GridViewCellCancelEventArgs, Exception)GridViewTemplate.SetError(GridViewDataErrorEventArgs)GridViewTemplate.Refresh()GridViewTemplate.Refresh(params GridViewColumn[])GridViewTemplate.EndUpdate()GridViewTemplate.EndUpdate(bool)GridViewTemplate.EndUpdate(DataViewChangedEventArgs)GridViewTemplate.NotifyRowExpanded()GridViewTemplate.LoadFrom(IDataReader)GridViewTemplate.BestFitColumns()GridViewTemplate.BestFitColumns(BestFitColumnMode)GridViewTemplate.ExpandAllGroups()GridViewTemplate.CollapseAllGroups()GridViewTemplate.ExpandAll()GridViewTemplate.CollapseAll()GridViewTemplate.GetDefaultCurrentRow(GridViewTemplate, GridViewInfo, bool)GridViewTemplate.BindingContextGridViewTemplate.ChildRowsGridViewTemplate.IsInitializedGridViewTemplate.SelectNewRowAsCurrentGridViewTemplate.IsUpdatingGridViewTemplate.SelectLastAddedRowGridViewTemplate.NewRowTextGridViewTemplate.TagGridViewTemplate.ShowFilterCellOperatorTextGridViewTemplate.HorizontalScrollStateGridViewTemplate.VerticalScrollStateGridViewTemplate.AllowDragToGroupGridViewTemplate.AllowColumnReorderGridViewTemplate.AllowRowResizeGridViewTemplate.AutoUpdateObjectRelationalSourceGridViewTemplate.CaptionGridViewTemplate.EnableAlternatingRowColorGridViewTemplate.UseCheckboxRowSelectionOnlyGridViewTemplate.SummaryRowGroupHeadersGridViewTemplate.SummaryRowsBottomGridViewTemplate.SummaryRowsTopGridViewTemplate.CaseSensitiveGridViewTemplate.PinnedColumnsGridViewTemplate.DataMemberGridViewTemplate.DataSourceGridViewTemplate.TemplatesGridViewTemplate.MasterViewInfoGridViewTemplate.GroupsGridViewTemplate.ColumnsGridViewTemplate.CurrentColumnGridViewTemplate.RowsGridViewTemplate.ParentGridViewTemplate.HierarchyLevelGridViewTemplate.ColumnCountGridViewTemplate.RowCountGridViewTemplate.AllowEditRowGridViewTemplate.AllowColumnChooserGridViewTemplate.AllowRowReorderGridViewTemplate.AllowColumnHeaderContextMenuGridViewTemplate.AllowRowHeaderContextMenuGridViewTemplate.AllowColumnResizeGridViewTemplate.AllowCellContextMenuGridViewTemplate.AllowAutoSizeColumnsGridViewTemplate.AllowDeleteRowGridViewTemplate.AllowAddNewRowGridViewTemplate.AllowSearchRowGridViewTemplate.EnableSortingGridViewTemplate.EnableCustomSortingGridViewTemplate.EnableGroupingGridViewTemplate.EnableCustomGroupingGridViewTemplate.EnableFilteringGridViewTemplate.EnableCustomFilteringGridViewTemplate.EnableHierarchyFilteringGridViewTemplate.AutoSizeColumnsModeGridViewTemplate.BottomPinnedRowsModeGridViewTemplate.ShowGroupedColumnsGridViewTemplate.AllowMultiColumnSortingGridViewTemplate.ReadOnlyGridViewTemplate.AutoGenerateColumnsGridViewTemplate.FilterDescriptorsGridViewTemplate.SortDescriptorsGridViewTemplate.GroupDescriptorsGridViewTemplate.ViewDefinitionGridViewTemplate.AutoExpandGroupsGridViewTemplate.AddNewRowPositionGridViewTemplate.SearchRowPositionGridViewTemplate.ShowRowHeaderColumnGridViewTemplate.ShowSelectColumnGridViewTemplate.ShowColumnHeadersGridViewTemplate.ShowFilteringRowGridViewTemplate.ShowHeaderCellButtonsGridViewTemplate.ChildViewTabsPositionGridViewTemplate.IsSelfReferenceGridViewTemplate.IsVirtualRowsGridViewTemplate.ShowTotalsGridViewTemplate.ShowSubTotalsGridViewTemplate.ShowCollapsedGroupSummariesGridViewTemplate.ShowParentGroupSummariesGridViewTemplate.ShowChildViewCaptionsGridViewTemplate.ContainsColumnExpressionGridViewTemplate.MergeCellsModeGridViewTemplate.MergeCellsEditModeGridViewTemplate.FilterPredicateGridViewTemplate.GroupPredicateGridViewTemplate.SortComparerGridViewTemplate.GroupComparerGridViewTemplate.ListSourceGridViewTemplate.DataViewGridViewTemplate.ViewChangedGridViewTemplate.CreateRowInfoGridViewTemplate.BindingContextChangedGridViewTemplate.PropertyChangingGridViewTemplate.PropertyChangedGridViewTemplate.InitializedComponent.Dispose()Component.GetService(Type)Component.ToString()Component.CanRaiseEventsComponent.EventsComponent.SiteComponent.ContainerComponent.DesignModeComponent.DisposedMarshalByRefObject.MemberwiseClone(bool)MarshalByRefObject.GetLifetimeService()MarshalByRefObject.InitializeLifetimeService()MarshalByRefObject.CreateObjRef(Type)...

Constructors

Initializes a new instance of the MasterGridViewTemplate class.

C#
public MasterGridViewTemplate()

Properties

Gets or sets a value indicating whether a new bound row should be added to the data source before entering edit mode.

C#
[Browsable(false)]
public bool AddNewBoundRowBeforeEdit { get; set; }

Gets or sets a value indicating whether the RadGridView will automatically generate hierarchical relationships from the data source structure when data binding is performed.

C#
[Browsable(false)]
public bool AutoGenerateHierarchy { get; set; }

Gets a value that indicates whether the IPagedCollectionView.PageIndex value is allowed to change.

C#
public virtual bool CanChangePage { get; }
Property Value:

true if the IPagedCollectionView.PageIndex value is allowed to change; otherwise, false.

Gets or sets a value that determines whether users can copy cell text values to the clipboard and whether row and column header text is included in the copy operation.

C#
[Browsable(false)]
public GridViewClipboardCopyMode ClipboardCopyMode { get; set; }

Gets or sets a value that determines whether users can cut cell text values to the clipboard and whether row and column header text is included in the cut operation.

C#
[Browsable(false)]
public GridViewClipboardCutMode ClipboardCutMode { get; set; }

Gets or sets a value that determines whether users can paste clipboard content into the RadGridView control and how the paste operation is handled.

C#
[Browsable(false)]
public GridViewClipboardPasteMode ClipboardPasteMode { get; set; }

Gets or sets the currently active row in the grid. Setting this property triggers current row changed events and updates the current column to match the new row's template if applicable.

C#
[Browsable(false)]
public GridViewRowInfo CurrentRow { get; set; }

Gets or sets the currently active GridViewInfo that represents the view containing the current row and associated template information.

C#
[Browsable(false)]
public GridViewInfo CurrentView { get; set; }

Gets or sets a value indicating whether data pagination is enabled for the current data view, allowing data to be displayed in pages.

C#
[Browsable(true)]
public bool EnablePaging { get; set; }

Gets the EventDispatcher instance responsible for managing and dispatching events within the master template. Creates a new instance if one does not already exist.

C#
[Browsable(false)]
public override EventDispatcher EventDispatcher { get; }

Overrides: GridViewTemplate.EventDispatcher

Gets or sets the hierarchy data provider for the master template. Only GridViewSelfReferenceDataProvider and GridViewSelfReferenceLoadOnDemandDataProvider types are supported for master templates.

C#
[Browsable(false)]
public override GridViewHierarchyDataProvider HierarchyDataProvider { get; set; }

Overrides: GridViewTemplate.HierarchyDataProvider

Gets a value that indicates whether a page index change is in process.

C#
public virtual bool IsPageChanging { get; }
Property Value:

true if the page index is changing; otherwise, false.

Gets the root master template. For MasterGridViewTemplate instances, this property returns itself as it represents the top-level template in the hierarchy.

C#
[Browsable(false)]
public override MasterGridViewTemplate MasterTemplate { get; }

Overrides: GridViewTemplate.MasterTemplate

Gets or sets a value indicating whether multiple cells, rows, or columns can be selected simultaneously in the RadGridView. When false, only single selection is allowed.

C#
public bool MultiSelect { get; set; }

Gets the RadGridView control that owns this master template instance.

C#
[Browsable(false)]
public RadGridView Owner { get; }

Gets the zero-based index of the current page.

C#
public virtual int PageIndex { get; }
Property Value:

The zero-based index of the current page.

Gets or sets the number of items to display on a page.

C#
public virtual int PageSize { get; set; }
Property Value:

The number of items to display on a page.

Gets or sets a value indicating whether paging is performed before grouping or vice versa.

C#
public virtual bool PagingBeforeGrouping { get; set; }
Property Value:

true if paging is performed before grouping; otherwise, false.

Gets the collection of GridViewRelation instances that define the hierarchical structure and parent-child relationships between templates in the grid.

C#
[Browsable(false)]
public GridViewRelationCollection Relations { get; }

Gets the collection of GridViewCellInfo instances that represent the cells currently selected by the user across all templates in the grid.

C#
[Browsable(false)]
public GridViewSelectedCellsCollection SelectedCells { get; }

Gets the collection of GridViewRowInfo instances that represent the rows currently selected by the user across all templates in the grid.

C#
[Browsable(false)]
public GridViewSelectedRowsCollection SelectedRows { get; }

Gets or sets the selection mode that determines how cells, rows, or columns can be selected in the RadGridView.

C#
public GridViewSelectionMode SelectionMode { get; set; }

Gets or sets the GridViewColumn that will contain the self-reference expander items for hierarchical data display in self-referencing scenarios.

C#
[Browsable(true)]
public GridViewColumn SelfReferenceExpanderColumn { get; set; }

Gets the GridViewSynchronizationService instance that coordinates event dispatch and synchronization across all templates and views within the RadGridView hierarchy.

C#
[Browsable(false)]
public GridViewSynchronizationService SynchronizationService { get; }

Gets the total number of pages.

C#
public virtual int TotalPages { get; }

Gets or sets a value indicating whether the grid operates in virtual mode, where data management operations such as sorting, filtering, and grouping are handled by the application rather than the grid control.

C#
[Browsable(false)]
public bool VirtualMode { get; set; }

Methods

Analyzes a queue of grid view events.

C#
protected override bool AnalyzeQueueCore(List<GridViewEvent> events)
Parameters:eventsList<GridViewEvent>

The list of events to analyze.

Returns:

bool

true if the queue was analyzed successfully; otherwise, false.

Overrides: GridViewTemplate.AnalyzeQueueCore(List<GridViewEvent>)

Begins the cell copy.

C#
public void BeginCellCopy()

Begins the row copy.

C#
public void BeginRowCopy()

Suspends event dispatching and begins a batch update operation to improve performance when making multiple changes to the grid.

C#
public override void BeginUpdate()

Overrides: GridViewTemplate.BeginUpdate()

Clears all selected rows and cells from their respective collections in an efficient batch operation.

C#
protected virtual void ClearSelectedRowsOrCells()

Copies the formatted values of the currently selected cells to the clipboard without removing them from the grid.

C#
public virtual void Copy()

Creates the binding context for the master template. The master template inherits its binding context from the RadGridView control.

C#
protected override BindingContext CreateBindingContext()
Returns:

BindingContext

Returns null as the master template uses the binding context from its parent RadGridView control.

Overrides: GridViewTemplate.CreateBindingContext()

Creates and returns a new GridViewListSource instance specifically configured for the master template.

C#
protected override GridViewListSource CreateListSource()
Returns:

GridViewListSource

A new GridViewListSource instance associated with this master template.

Overrides: GridViewTemplate.CreateListSource()

Moves the currently selected cells or rows to the clipboard, removing their values from the grid.

C#
public virtual void Cut()

Releases the unmanaged resources used by the Component and optionally releases the managed resources.

C#
protected override void Dispose(bool disposing)
Parameters:disposingbool

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

Overrides: GridViewTemplate.Dispose(bool)

Ends the cell copy.

C#
public void EndCellCopy()

Completes the initialization of the master template and triggers hierarchy generation if no child templates exist.

C#
public override void EndInit()

Overrides: GridViewTemplate.EndInit()

Ends the row copy.

C#
public void EndRowCopy()

Resumes event dispatching and ends the batch update operation, triggering hierarchy changed events across all templates in the grid.

C#
public override void EndUpdate(bool notify, DataViewChangedEventArgs e)
Parameters:notifybool

Indicates whether to notify listeners of the changes.

eDataViewChangedEventArgs

The data view changed event arguments containing information about the changes.

Overrides: GridViewTemplate.EndUpdate(bool, DataViewChangedEventArgs)

Retrieves the formatted values that represent the contents of the selected cells for copying to the clipboard without actually placing them on the clipboard.

C#
public virtual DataObject GetClipboardContent()
Returns:

DataObject

A DataObject containing the formatted cell values in multiple clipboard formats.

Retrieves and parses clipboard data in multiple formats (HTML, Text, CSV) and returns it as a structured collection of rows and columns.

C#
protected virtual List<List<string>> GetClipboardData()
Returns:

List<List<string>>

A list of lists representing rows and columns of clipboard data.

Gets the event listener priority for the master template, which is set to highest priority to ensure it processes events first.

C#
protected override EventListenerPriority GetEventListenerPirotiy()
Returns:

EventListenerPriority

The Highest priority level.

Overrides: GridViewTemplate.GetEventListenerPirotiy()

Gets the event processing mode for the master template, enabling all phases of event processing including pre-processing, processing, post-processing, and queue analysis.

C#
protected override GridEventProcessMode GetEventProcessMode()
Returns:

GridEventProcessMode

A combination of GridEventProcessMode flags indicating comprehensive event processing.

Overrides: GridViewTemplate.GetEventProcessMode()

Gets the collection of existing rows where clipboard data should be pasted, starting from the current row position.

C#
protected virtual List<GridViewRowInfo> GetRowsToPasteIn(int numberOfRowsToGet)
Parameters:numberOfRowsToGetint

The number of rows to retrieve for pasting.

Returns:

List<GridViewRowInfo>

A list of GridViewRowInfo objects representing the target rows for pasting.

Sets the first page as the current page.

C#
public virtual bool MoveToFirstPage()
Returns:

bool

true if the operation was successful; otherwise, false.

Sets the last page as the current page.

C#
public virtual bool MoveToLastPage()
Returns:

bool

true if the operation was successful; otherwise, false.

Moves to the page after the current page.

C#
public virtual bool MoveToNextPage()
Returns:

bool

true if the operation was successful; otherwise, false.

Requests a page move to the page at the specified zero-based index.

C#
public virtual bool MoveToPage(int pageIndex)
Parameters:pageIndexint

The zero-based index of the page to move to.

Returns:

bool

true if the operation was successful; otherwise, false.

Moves to the page before the current page.

C#
public virtual bool MoveToPreviousPage()
Returns:

bool

true if the operation was successful; otherwise, false.

Handles property change notifications, triggering hierarchy generation when DataSource or DataMember properties change.

C#
protected override void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
Parameters:ePropertyChangedEventArgs

The PropertyChangedEventArgs containing information about the changed property.

Overrides: GridViewTemplate.OnNotifyPropertyChanged(PropertyChangedEventArgs)

Called when the page is changed.

C#
protected virtual void OnPageChanged(object sender, EventArgs e)
Parameters:senderobject

The sender.

eEventArgs

The EventArgs instance containing the event data.

Called when the page is changing.

C#
protected virtual void OnPageChanging(object sender, PageChangingEventArgs e)
Parameters:senderobject

The sender.

ePageChangingEventArgs

The PageChangingEventArgs instance containing the event data.

Handles view change events and performs additional logic such as paging adjustments when the view is reset.

C#
protected override void OnViewChanged(object sender, DataViewChangedEventArgs e)
Parameters:senderobject

The source of the event.

eDataViewChangedEventArgs

The DataViewChangedEventArgs containing information about the view change.

Overrides: GridViewTemplate.OnViewChanged(object, DataViewChangedEventArgs)

Pastes the contents from the clipboard into the grid starting at the current cell position, creating new rows if necessary when pasting multiple rows.

C#
public virtual void Paste()

Pastes the data to new row.

C#
protected virtual void PasteDataToNewRow(List<string> rowData)
Parameters:rowDataList<string>

The row data.

Pastes a row of clipboard data into an existing grid row, performing data type conversion and validation as needed.

C#
protected virtual void PasteDataToRow(List<string> rowData, GridViewRowInfo row)
Parameters:rowDataList<string>

The list of string values representing the clipboard row data.

rowGridViewRowInfo

The target GridViewRowInfo where the data will be pasted.

Post-processes grid events, handling row disposal and view change cleanup operations after the main event processing is complete.

C#
protected override GridViewEventResult PostProcessEventCore(GridViewEvent eventData)
Parameters:eventDataGridViewEvent

The GridViewEvent containing event information.

Returns:

GridViewEventResult

A GridViewEventResult indicating the post-processing outcome, or null if no special handling is required.

Overrides: GridViewTemplate.PostProcessEventCore(GridViewEvent)

Pre-processes grid events, particularly current row change events, to determine if the event should continue processing or be canceled.

C#
protected override GridViewEventResult PreProcessEventCore(GridViewEvent eventData)
Parameters:eventDataGridViewEvent

The GridViewEvent containing event information.

Returns:

GridViewEventResult

A GridViewEventResult indicating whether to continue event processing or cancel it.

Overrides: GridViewTemplate.PreProcessEventCore(GridViewEvent)

Processes core grid events including current row changes, template data source initialization, and column collection changes.

C#
protected override GridViewEventResult ProcessEventCore(GridViewEvent eventData)
Parameters:eventDataGridViewEvent

The GridViewEvent containing event information.

Returns:

GridViewEventResult

A GridViewEventResult indicating the processing outcome, or null to continue with default processing.

Overrides: GridViewTemplate.ProcessEventCore(GridViewEvent)

Resets the master template to its default state by clearing all child templates, relations, columns, and resetting the data source and AutoGenerateHierarchy property.

C#
public void Reset()

Resets the current row.

C#
protected override void ResetCurrentRow()

Overrides: GridViewTemplate.ResetCurrentRow()

Sets the current position in the grid by changing the active row and column, with optional validation of the row change.

C#
protected bool SetPosition(GridViewRowInfo row, GridViewColumn column, bool validateRowChange)
Parameters:rowGridViewRowInfo

The GridViewRowInfo to set as the current row.

columnGridViewColumn

The GridViewColumn to set as the current column.

validateRowChangebool

Indicates whether to validate the row change operation.

Returns:

bool

True if the position was successfully changed; otherwise, false.

Performs the core logic for setting the current position, including event handling, current row/column changes, and UI updates.

C#
protected virtual bool SetPositionCore(GridViewRowInfo newRow, GridViewColumn newColumn, GridViewRowInfo oldRow, GridViewColumn oldColumn, bool validateRowChange)
Parameters:newRowGridViewRowInfo

The new GridViewRowInfo to set as current.

newColumnGridViewColumn

The new GridViewColumn to set as current.

oldRowGridViewRowInfo

The previous current row.

oldColumnGridViewColumn

The previous current column.

validateRowChangebool

Indicates whether to validate the row change operation.

Returns:

bool

True if the position change was successful; otherwise, false.

Unsubscribes from internal events to prevent memory leaks when the master template is being disposed.

C#
protected override void UnwireEvents()

Overrides: GridViewTemplate.UnwireEvents()

Subscribes to internal events required for the master template functionality, including paging events from the data view.

C#
protected override void WireEvents()

Overrides: GridViewTemplate.WireEvents()