none
DataContext Property OnChanging Methods RRS feed

  • Question

  • I have a data grid view that's bound to a Binding Source which is bound to class created using the dbml designer LINQ to SQL designer in Visual Studio.  I want to be able to cancel a change to the value of one of the datagridview cells from the OnChanging method in the underlying Partial Class, the only way I've found to do this is by throwing an exception.  Is there a better way?

    Thanks In Advance

    Alex

    Tuesday, September 30, 2014 1:51 PM

All replies

  • Hello Alex,

    >> I want to be able to cancel a change to the value of one of the datagridview cells from the OnChanging method in the underlying Partial Class,

    In the underlying Partial Class, I do not think it is possible, for achieving cancel a change in LINQ2SQL, you could use the DataContext.Refresh Method to refresh object state by using data in the database.

    Yon could check this link for a detail usage:

    http://stackoverflow.com/a/20427609

    Best Regards,

    Fred.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 6, 2014 2:16 AM
    Moderator