[Expand]General Information
[Collapse]WinForms Controls
 [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 With Data Grid and Views
   [Expand]Data Binding
    Unbound Columns
   [Expand]Data Editing and Validation
   [Expand]Filter and Search
   [Expand]Focus and Selection Handling
    Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
   [Expand]Batch Modifications
   [Expand]Hit Information
    Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
    [Expand]Conditional Formatting
    [Expand]Data Binding
    [Expand]Data Editing
    [Expand]Data Presentation
    [Expand]Export and Printing
    [Expand]General Use
    [Expand]Layout View
    [Collapse]Navigation and Selection
      Examples: Navigation and Selection
      How to: Expand/Collapse a Group Row When It Receives Focus
      How to: Hide Specific Buttons in the Embedded Navigator
      How to: Make the entire focused row highlighted
      How to: Move Focus to a Specific Column
      How to: Obtain and Modify Selected Rows
      How to: Scroll a View Horizontally Using the Mouse Wheel
    [Expand]Skins and Look and Feel
    [Expand]Sorting and Grouping
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Obtain and Modify Selected Rows

This example demonstrates how to obtain selected rows and then change their field values. The handles of selected rows are retrieved by the ColumnView.GetSelectedRows method. Since row handles reflect the order in which rows are displayed within a View, modifying a single row may affect the handles of other rows (e.g., if data is sorted and/or filtered). To prevent possible data corruption, a target row is modified using an underlying record object (in this example, a DataRow object). DataRows that correspond to selected rows are retrieved using the ColumnView.GetDataRow method and are stored in an array prior to data modification.

Bear in mind that when updating multiple rows, Grid View is updated after every row modification. So, to prevent unnecessary updates, you should enclose your code within calls to the BaseView.BeginUpdate and BaseView.EndUpdate methods. Refer to the Batch Modifications Overview document for details.

Is this topic helpful?​​​​​​​