Check data before row selection has been changed

4 posts, 0 answers
  1. Richard Koslik
    Richard Koslik avatar
    71 posts
    Member since:
    Apr 2010

    Posted 08 Nov 2010 Link to this post

    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
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 09 Nov 2010 Link to this post

    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
  3. DevCraft banner
  4. Richard Koslik
    Richard Koslik avatar
    71 posts
    Member since:
    Apr 2010

    Posted 12 Nov 2010 Link to this post

    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
  5. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 18 Nov 2010 Link to this post

    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
Back to Top