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

Rowvalidating missing properties

3 Answers 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
martin bertram
Top achievements
Rank 1
martin bertram asked on 12 Nov 2010, 12:47 AM
Hi,

I am using a WPF radgridview and the RowValidating event:

 

 

Private Sub RadGridView1_RowValidating(ByVal sender As System.Object, ByVal e As Telerik.Windows.Controls.GridViewRowValidatingEventArgs)

 

e.IsValid =

 

False

 

 

 

End Sub

 


According to the documentation, there is a NewValues property which can be used to access the new values, as well as an OldValues property.  The OldValues property is there but I don't see NewValues.  Also, is there any way to provide an error message for rowvalidating like you can with cellvalidating?

Thanks

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 12 Nov 2010, 11:04 AM
Hi martin bertram,

Indeed, you are quite right. We have made that property obsolete and removed it. However, we are considering the implementation of another - similar, but improved one that will replace the NewValues.
As for your second requirement, you may add GridViewCellValidationResult, set its ErrorMessage property and add it to the ValidationResults collection.

Kind regards,
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
0
martin bertram
Top achievements
Rank 1
answered on 12 Nov 2010, 09:51 PM
Is there any way for me to retrieve the values of the cells in a row during the RowValidating event?
0
Maya
Telerik team
answered on 15 Nov 2010, 01:03 PM
Hi martin bertram,

You may use exposed properties - in this case "Row" and get the corresponding item. Afterwards, you will be able to retrieve the values by its properties. For example:

private void clubsGrid_RowValidating(object sender, GridViewRowValidatingEventArgs e)
{
    var row = e.Row as GridViewRow;
    var club = this.clubsGrid.ItemContainerGenerator.ItemFromContainer(row) as Club;
    if(club != null)
    {
        var name = club.Name;
        var established = club.Established;
        var capacity = club.StadiumCapacity;
    }
}


Sincerely yours,
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
martin bertram
Top achievements
Rank 1
Answers by
Maya
Telerik team
martin bertram
Top achievements
Rank 1
Share this question
or