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

Validating Data on a Property Level (GridView)

1 Answer 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brian
Top achievements
Rank 1
Brian asked on 05 Apr 2011, 08:01 PM

The following link describes how to validate data on a property level for a GridView. 
http://www.telerik.com/help/silverlight/gridview-managing-data-validation.html

However, this does not seem to work (code sample below).  The documentation says that throwing a new Exception will result in a binding validation error and the column will enter into an invalid state.  I simply get an unhandled exception error.

 

 

 

 

public long TradeKeyValidated

 

 

{

 

 

 

    get { return this.TradeKey; }

 

 

 

 

    set

 

 

    {

 

 

 

        if (value < 0) throw new Exception("Some exception message.");

 

 

 

 

        if (value != this.TradeKey)

 

 

        {

 

 

 

            this.TradeKey = value;

 

 

 

 

            this.RaisePropertyChanged("TradeKeyValidated");

 

 

        }

 

    }

 

}

Please advise.  Thanks!

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 06 Apr 2011, 09:03 AM
Hello Brian,

Generally, the exception you get is a handled one and once you continue running the application, you will get the error message in the ToolTip. However, the more recommended way for handling such scenarios is to use INotifyDataErrorInfo. You may take a look at this blog post for an example. Another approach may be to handle the CellValidating event, but this validation will be a grid-specific.

Best wishes,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Brian
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or