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

Check data before row selection has been changed

3 Answers 102 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard Koslik
Top achievements
Rank 1
Richard Koslik asked on 08 Nov 2010, 11:28 AM
Hello!

I have a Gridview and the selectedItem is displayed in some fields beside the GridView. Now I want to check the correctness of the data in the detail fields, before the user changes the selected row in the GridView. If the data is correct I want to save the data (SubmitChanges). The user can only change the data outside the grid (in the detail fields) not directly in the cells.

Which event can I use for this situation? I looked for "OnRowValidating", but it is never called. I searched for it in the online help and there is descriped that I have to set a property named "ValidationMode", but I am not able to find it? Does it exist or not?

http://www.telerik.com/help/silverlight/gridview-rowvalidating-event.html

Maybe somenone has an idea how to solve this problem. Thanks.

Best Regards, Richard

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 09 Nov 2010, 08:56 AM
Hello Richard Koslik,

The RadGridView's validation logic will not get executed when the item is edited outside the gridview.
Basically, you need an event which fires before the selection is made in RadGridView. In Q3 2010 which will be released later this week, we are introducing a new event - SelectionChanging which can be canceled if you do not want to change the current selected item.

Hope this helps.

Kind regards,
Veselin Vasilev
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
Richard Koslik
Top achievements
Rank 1
answered on 12 Nov 2010, 10:20 AM
Hello,

today I downloaded the newest version of the Silverlight components. I tried now the new event SelectionChanging and it doens't works how you said. During the debugging I found following out:

- the first row in my GridView is selected
- now I change some data in the detail fields (SelectedItem)
- then I click on the next row in my GridView
- the SelectedItem is changed
- AFTER that the SelectionChanging Event occured!!

Now I have the same problem as before, that I am not able to cancel the selection. Is there any other solution or something I missed?

Thanks for your answer,
regards Richard
0
Milan
Telerik team
answered on 18 Nov 2010, 01:11 PM
Hello Richard Koslik,

That is very strange. Is the SelectedItem bound to some ViewModel property or  is it purely changed from the UI? 

I have attached a sample application that mimics your scenario and seems to work as expected.


Greetings,
Milan
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Richard Koslik
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Richard Koslik
Top achievements
Rank 1
Milan
Telerik team
Share this question
or