This is a migrated thread and some comments may be shown as answers.

Issue while Copying Content From RadGridView

1 Answer 88 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vasista
Top achievements
Rank 1
Vasista asked on 05 May 2014, 11:38 AM
Hi

We're facing an issue while copying content from RadGridView to Excel.
Our RadGridView has a GridViewSelectColumn as first column, which must be ignored while copying.
When we select rows and copy the content, we are getting the first column header as 'System.Windows.Controls.CheckBox Content: IsChecked:False'

To eleminate this, we've placed the below work-arround for supressing the column from being copied:

Dim checkBoxColumn = CType(sender, RadGridView).Columns("CheckBoxColumn")
 
If checkBoxColumn IsNot Nothing AndAlso originalText.Contains(checkBoxColumn.Header.ToString) Then
    updatedText = originalText.Replace(checkBoxColumn.Header.ToString, String.Empty)
    Telerik.Windows.Controls.Clipboard.SetText(updatedText)
Else
    Telerik.Windows.Controls.Clipboard.SetText(originalText)
End If


Using the above logic, we're able to clear the content from being copied but, we're getting the cell in the copied content.
That is, when pasted in excel, the first column being pasted with empty header and empty cell contents.

Please help us to eleminate the complete column from getting copied.

There is a similar issue with ignoring columns while pasting back from Excel to RadGridView

Regards
Vasista

1 Answer, 1 is accepted

Sort by
0
Vera
Telerik team
answered on 05 May 2014, 12:25 PM
Hi Vasista,

I would suggest you to check RadGridView Copy paste functionality example available in our SDK browser. It demonstrates how to copy a row by excluding GridViewSelectColumn.
Please download the SDK browser so you can test the project locally on your side.

Regards,
Vera
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Vasista
Top achievements
Rank 1
Answers by
Vera
Telerik team
Share this question
or