Setting the Data Form current item

2 posts, 0 answers
  1. Marcelo
    Marcelo avatar
    40 posts
    Member since:
    Jul 2011

    Posted 08 Nov 2011 Link to this post

    I have a Data Form and a Grid. What I am doing is that every time we move forward or backwards in the Data Form, the Grid gets updated, sometimes by manually setting the current item in the Data Form and consequently updating the Grid based on an ID key.

    Example #1:

    Adding a new record to the Data Form. I use the Edit Ended event to Save the changes via EF. This works fine. After saving I am setting the Data Form current item to the newly created record. In my case, this means updating the Data Form (re-loading all values from the database), doing a look up and updating the Data Form current item and finally updating the Grid.

    This is not working for me. Re-loading the Data Form works but setting the Data Form current item is not working

    Example #2:

    After I enter a new Data Form item, EF returns back an error on dups. (based on PK), which is perfect. Since the item exists, I want to position the Data Form on that record by manually setting the current item, but this is not working either.

    When I say that it does not work, I mean that after I do the following on the EditEnded event:

    this.dataForm.CurrentItem = [Do a look up based on PK and return object]

    The Current Item Changed event fires (which is expected) and there I update the Grid, but at this point is where dataForm.CurrentItem is null preventing me from updating the Grid

    Ideas/comments are appreciated.

    Thanks, M
  2. Ivan Ivanov
    Ivan Ivanov avatar
    1114 posts

    Posted 11 Nov 2011 Link to this post

    Hello Marcelo,

    As we have suggested to you in the other support thread you have opened, I would advise you to work  with a collection implementing ICollectionView. Thus you will be able to work with its CurrentItem property and synchronize it with RadDataForm. Is there any specific reason that prevents you from using such a collection ? 

    Best wishes,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft R3 2016 release webinar banner
Back to Top