RadNumericTextBox DBvalue and LINQ/SQL

2 posts, 0 answers
  1. kyle
    kyle avatar
    22 posts
    Member since:
    Feb 2008

    Posted 02 Mar 2008 Link to this post

    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?
  2. John
    John avatar
    416 posts
    Member since:
    Oct 2006

    Posted 05 Mar 2008 Link to this post

    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.

    <John:Peel />
Back to Top