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

When paging, grid on Edit Form no longer has reference to data that originally opened edit form

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sheryl Landon
Top achievements
Rank 1
Sheryl Landon asked on 11 Aug 2008, 07:51 PM
Hi - we have a RadGrid that has an edit form associated with each row, and the edit form loads a custom control. 

When the edit form control loads, I am able to get a reference back to the RadGrid data item using this._dataItem;

The edit form control loads some basic data and then another grid for some detail data, and we use the id from the parent RadGrid dataitem to load this detail grid in the edit form.  We have enabled paging on the grid in the edit form.

The problem is that when one of the paging controls is hit on the grid in the edit form, and the grid tries to "re-get" the data in the "Grid_NeedDataSource" method in order to display the next subset, this._dataItem is now null, so we don't have access to the parent data item id in order to re-get the detail data for the edit form.

So, the question is, is there something I need to do to make sure that I still have a reference to the data that opened the edit form, when the request for the next page of data is made on the edit form?

thanks,
Sheryl


1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 14 Aug 2008, 03:17 PM
Hi Sheryl Landon,

The user control must implements a public DataItem property through which Telerik RadGrid will sets the correct values for the editor controls (when loading the user control). This allows the developer to write binding expressions to bind the server controls in the user control to the corresponding DataItem.

In the attached example i've modified the setter of this property so the first time it is accessed the value is saved in ViewState. Thus paging of the inner grid will work correctly.

Please find the attached project.

Best wishes,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Sheryl Landon
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or