Determine CurrentCell during PastingCellClipboardContent event

7 posts, 0 answers
  1. Matthew
    Matthew avatar
    46 posts
    Member since:
    Aug 2011

    Posted 17 Oct 2011 Link to this post

    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...
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 18 Oct 2011 Link to this post

    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 >>

  3. Matthew
    Matthew avatar
    46 posts
    Member since:
    Aug 2011

    Posted 18 Oct 2011 Link to this post

    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.
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 19 Oct 2011 Link to this post

    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 >>

  5. Matthew
    Matthew avatar
    46 posts
    Member since:
    Aug 2011

    Posted 20 Oct 2011 Link to this post

    Is there a way I could call CellValidating from the PastingCellClipboardContent event?
  6. Matthew
    Matthew avatar
    46 posts
    Member since:
    Aug 2011

    Posted 20 Oct 2011 Link to this post

    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?
  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 21 Oct 2011 Link to this post

    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 >>

Back to Top