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

RadNumericTextBox DBvalue and LINQ/SQL

1 Answer 302 Views
Input
This is a migrated thread and some comments may be shown as answers.
kyle
Top achievements
Rank 1
kyle asked on 02 Mar 2008, 06:43 PM
We have a int field in a database table which can be null. We are using LINQ/SQL.  The tables dataContext is pointing to the linq/dbml and is tied to a linqDataSource for our RadGrid.

When doing addnew or edit, we can bind(int field) to the RadNumericTextBox.dbvalue just fine.  But the issue is on save!
The dbvalue field allows the RadNumericTextBox to handle the null, but causes an issue when saving the value to linq because DBvalue is of type 'object' not int.

the error when update/saving is:

Failed to set one or more properties on type BillMaster.DAL.PaymentGateway.  Ensure that the input values are valid and can be converted to the corresponding property types.

How can we resolve this?

1 Answer, 1 is accepted

Sort by
0
plamen
Top achievements
Rank 1
answered on 05 Mar 2008, 05:36 PM
hi kyle



You have to handle the Updating  event handler to change the updated values before the update operation, or to cancel the update operation. The LinqDataSourceUpdateEventArgs object that is passed to event handlers contains both the original object and the updated object.


Regards...
<John:Peel />
Tags
Input
Asked by
kyle
Top achievements
Rank 1
Answers by
plamen
Top achievements
Rank 1
Share this question
or