Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Summaries
   [Collapse]Data Editing
    [Expand]Edit Form
    [Expand]Editing via Code
    [Collapse]In-place Editors
      In-place Editors Overview
      Assigning Editors for In-Place Editing
      Assigning Editors to Columns and Card Fields
      Assigning Editors to Individual Cells
      Showing and Hiding Editors
    [Expand]Input Validation
    [Expand]New Item Row
     Tutorial: Add or Remove Rows
     Tutorial: Data Input Validation
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Assigning Editors to Individual Cells

This topic explains how to provide in-place editors for individual cells within a View (this is only available in Grid Views). This method of assigning an editor should be used when utilizing a single editor for all cells within a column doesn't meet your needs. If you need the same editor for all cells within a column, use the editor binding approach described in the Assigning Editors to Columns and Card Fields document. The In-place Editors Overview topic describes the basics of using editors within Views.

Expanded Online Videos

Expanded Assigning Editors to Individual Cells

At runtime, you can assign editors to individual cells by handling the GridView.CustomRowCellEdit (or LayoutView.CustomRowCellEdit) event. The event occurs dynamically for each visible cell and allows you to supply an editor to individual cells, based on the position of the cell (its column and row).

The editor assigned via this event will be used for representing the cell content in display mode and by default, for in-place editing. If you need to provide a different editor for use in edit mode, handle the GridView.CustomRowCellEditForEditing event. See Assigning Editors for In-Place Editing for more details.

Note

If you handle the GridView.CustomRowCellEdit event to supply an editor for a specific row based on its focused state, this editor will not be used for editing. In this instance, to use a specific editor for editing, you should handle the GridView.CustomRowCellEditForEditing event.

While handling the GridView.CustomRowCellEdit event, use the event's Column and RowHandle parameters to identify the cell currently being processed. The Column parameter specifies the column that contains the cell, the RowHandle parameter identifies the row's handle.

To provide an editor for the currently processed cell, assign a specific repository item to the event's RepositoryItem parameter. The repository items to be used must be added to the grid's internal or external repository. Please refer to the Repositories and Repository Items topic for details on the repository technology.

Note

The GridView.CustomRowCellEdit event is raised when a View recalculates its visual information. Sometimes however, you may need to force editor reassignment manually. To do so, call the View's BaseView.LayoutChanged method.

When a cell editor is activated, the grid generates the ColumnView.ShownEditor event. This allows you to customize the editor's settings to implement a different behavior. See the Accessing the Active Editor section of the Showing and Hiding Editors topic for details.

Expanded Example 1

The following example shows how to handle the GridView.CustomRowCellEdit event to assign ComboBoxEdit, SpinEdit and CheckEdit editors to cells, depending on the FieldName column value. It is assumed that the repository items corresponding to these editors are already in a repository.

The screenshots below show the grid's appearance before and after executing the code. The ColumnView.ShowButtonMode property is set to ShowButtonModeEnum.ShowAlways for demonstration purposes.

Expanded Example 2

The following example assigns different ComboBoxEdit editors (with different sets of items) to cells of the ShipCity column. The editor is assigned to a cell based on the ShipCountry cell value. It is assumed that the repository items used are already in a repository.

The image below shows the View before and after executing the sample code:

Expanded See Also

How would you rate this topic?​​​​​​​