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

Setting the Data Form current item

1 Answer 216 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Marcelo
Top achievements
Rank 1
Marcelo asked on 08 Nov 2011, 07:00 PM
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

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 11 Nov 2011, 03:57 PM
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 >>
Tags
DataForm
Asked by
Marcelo
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or