Version

Clipboard

Purpose

This topic explains how to configure Clipboard support for the WebDataGrid™ and WebHierarchicalDataGrid™controls.

Required background

You need to first read the following topics:

Note
Note:

There are numerous browser limitations when accessing the Clipboard. Please refer to the Known Issues and Breaking Changes topic for details regarding browser support.

Clipboard Configuration Overview

Introduction

Using the standard keyboard shortcuts of CTRL+C to copy, CTRL+V to paste, and CTRL+X to cut users can manipulate the grid’s data in the clipboard.

The Clipboard behavior is added to the grid like the other grid behaviors through markup, code, or the designer. The Selection and Activation behaviors are required to select cells for copying. The Editing core behavior is required to store pasted data over post backs.

Clipboard configuration chart

The table below lists the configurableClipboard behaviors of the WebDataGrid and WebHierarchicalDataGrid.

Configurable behavior Configuration details Configuration properties

Clipboard support

Adds the Clipboard behavior to the grid.

  • Behaviors

Configuring cut, copy, and paste individually

The cut, copy, and paste operations can be turned on or off independently of each other.

  • EnableCopy

  • EnableCut

  • EnablePaste

Copying column headers

Configures the copy and paste operations to copy the column header text for pasting into another application.

  • CopyColumnHeader

Enabling Clipboard Support

In ASPX:

<ig:WebDataGrid ID="wdg1" runat="server">
    <Behaviors>
        <ig:Clipboard />
    </Behaviors>
</ig:WebDataGrid>

In C#:

Clipboard gridClipboard = this.WebDataGrid1.Behaviors.CreateBehavior<Clipboard>();

In Visual Basic:

Dim gridClipboard As Clipboard = Me.WebDataGrid1.Behaviors.CreateBehavior(Of Clipboard)()

Configuring the Cut, Copy, and Paste Functionalities Individually

Individual clipboard functionalities support

The copy operation can be turned on or off independently of the other behaviors. The cut and paste behaviors can be individually configured as well. In order to only allow copying, you must disable the cut and paste operations. All clipboard features are turned on by default when adding the Clipboard behavior.

Configuring the property settings for partial clipboard support

The table below maps the desired behaviors to property settings. The properties are accessed through the WebDataGrid’s Clipboard behavior.

In order to… Use this property: And set it to…​

Disable cut operations

EnableCut

false

Disable copy operations

EnableCopy

false

Disable paste operations

EnablePaste

false

Example: allowing only copy operations

Allowing only copy operations can be seen in the grid as a result of the following settings:

Property Setting

EnableCut

false

EnablePaste

false

For detailed information about these properties, refer to their listing in the property reference section:

Copying Column Headers

Copying column headers overview

You can configure the Clipboard behavior to copy the column header information so that when the values are pasted into another application such as Excel®, the data is pasted underneath the copied header information.

WebDataGrid Clipboard 01.png
WebDataGrid Clipboard 02.png

Copying column headers property settings

The table below maps the desired behaviors to property settings. The properties are accessed through the Clipboard behavior.

In order to… Use this property: And set it to…​

Enable column headers to be copied

CopyColumnHeader

true

Following are some other topics you may find useful.