I am pasting data from Excel into a radGridView object and would like to do some custom validation from the PastingCellClipboardContent Event.
I have an object of type Widget which implements INotifyPropertyChanged. It has the following member variables:
- String Type
- String PartNum
- Double Cost
When pasting in the data, I need to check that the PartNum for a Widget is valid based on the Type. So I have a WCF Service setup that uses a query to return information for a PartNum using the Type.
In PastingCellClipboardContent I am doing the following...
However, when debugging the code... Row.Type is null so the lookup done in ValidatePartNum returns nothing, even though the Type cell displays a valid value on the Grid after all validation is complete. Furthermore, I would expect the PartNum field to display "NONE", but it shows whatever the information copy/pasted from Excel contained.
Any ideas what I'm doing wrong?
I have an object of type Widget which implements INotifyPropertyChanged. It has the following member variables:
- String Type
- String PartNum
- Double Cost
When pasting in the data, I need to check that the PartNum for a Widget is valid based on the Type. So I have a WCF Service setup that uses a query to return information for a PartNum using the Type.
In PastingCellClipboardContent I am doing the following...
void rgvBulkEntry_PastingCellClipboardContent(Object sender, GridViewCellClipboardEventArgs e)
{
GridViewCellInfo cellInfo = e.Cell as GridViewCellInfo;
Widget Row = cellInfo.Item as Widget;
WebService.ValidatePartNum(Row.Type);
Cell.Value = PartNumLookupValue;
}
private void WebService_ValidatePartNumCompleted(Object sender, ValidatePartNumCompletedEventArgs e)
{
if (e.Result == null)
{
PartNumLookupValue = "NONE";
}
else
{
PartNumLookupValue = e.Result;
}
}
However, when debugging the code... Row.Type is null so the lookup done in ValidatePartNum returns nothing, even though the Type cell displays a valid value on the Grid after all validation is complete. Furthermore, I would expect the PartNum field to display "NONE", but it shows whatever the information copy/pasted from Excel contained.
Any ideas what I'm doing wrong?