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

Paste functionality not working with formatted data.

1 Answer 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 29 Apr 2011, 12:44 AM
I am using the following code to programatically paste content from Excel into the RadGridView:

 

 

var pasteCommand = RadGridViewCommands.Paste as RoutedUICommand;

 

 

pasteCommand.Execute(

 

null, this.radGridView);

 


When the excel content contains no formatting, the paste operation works perfectly (ex - "123").  However, when excel content contains formatted text (ex - "$123.00), the values are not pasted.

Example column definition:

<

 

 

telerik:GridViewDataColumn

 

 

 

 

    DataMemberBinding="{Binding InvoicedAccountsPayable, Mode=TwoWay}"

 

 

 

 

    DataFormatString="{}{0:$#,##0.00;($#,##0.00)}"/>

 


...where InvoicedAccountsPayable is defined as:

public

 

 

decimal? InvoicedAccountsPayable { get; set; }

 


I'm guessing the pasted value is not able to be parsed into a string.  Is there a solution short of redefining InvoicedAccountsPayable as a string?

Thanks,
Brian

1 Answer, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 29 Apr 2011, 02:09 AM
Hello Brian,

 In this case you need to handle the PastingColumnClipboardContent event and supply your own pasting logic.

Regards,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Brian
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Share this question
or