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

Determine CurrentCell during PastingCellClipboardContent event

6 Answers 55 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 17 Oct 2011, 06:47 PM
As the subject says, I need to know the Current Cell (as type GridViewCell) from within this event in order to do some additional validation.

How would I get this information?

        void rgvBulkEntry_PastingCellClipboardContent(Object sender, GridViewCellClipboardEventArgs e)
        {
            ValidateData(e.Cell.Column.UniqueName, e.Value.ToString(), (GridViewCell)e.Cell);
        }

(GridViewCell)e.Cell fails as e.Cell is of type GridViewCellInfo...

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 18 Oct 2011, 07:09 AM
Hi Matthew,

Generally, there is no easy way to convert GridViewCellInfo into GridViewCell. The basic reason is that the virtualization of the grid is turned on by default and not all cells are available. 
Would you clarify a bit what is the scenario that you want to accomplish ? Why do you need GridViewCell instead of GridViewCellInfo ?
 

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Matthew
Top achievements
Rank 1
answered on 18 Oct 2011, 03:19 PM
I am attempting to have a single function that I could call in order to validate data in the radGridVIew cells during both the PastingCellClipboardContent and CellValidating events.
0
Maya
Telerik team
answered on 19 Oct 2011, 07:05 AM
Hi Matthew,

You can still use the GridViewCellInfo from the PastingCellClipboardContent event - it gives you information for the Item and the Value as well. Another possible approach would be to execute the validation in the setter of your property that will be called on pasting a new value. 
 

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Matthew
Top achievements
Rank 1
answered on 20 Oct 2011, 05:41 PM
Is there a way I could call CellValidating from the PastingCellClipboardContent event?
0
Matthew
Top achievements
Rank 1
answered on 20 Oct 2011, 08:56 PM
Hi Maya,

I am using a WCF service to get data which then is updated into other fields of the object - however I think the asynchronous calls that it is making is causing the results to be very spotty - do you have any suggestions on this?
0
Maya
Telerik team
answered on 21 Oct 2011, 07:19 AM
Hello Matthew,

You can try to validate the item not in any event but either in the setter of the properties for example ( that will be called event when pasting a new value) or implementing INotifyDataErrorInfo Interface. Please take a look at this blog post on the later approach.
 

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Matthew
Top achievements
Rank 1
Answers by
Maya
Telerik team
Matthew
Top achievements
Rank 1
Share this question
or