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

Bad DataItem given to usercontrol in edit mode

1 Answer 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 01 Feb 2009, 01:28 AM
I've got a UserControl that I want to use as the edit form inside a grid. The DataItem is a structure with a collection of classes inside. When I click the Edit button to bring up the grid the DataItem I get is fine, but then when I click the button that fires the UpdateCommand event the DataItem I receive a DataItem without any of the classes that should be inside it (the collection in the structure is null).

I also don't understand why the grid would later fire NeedDataSource *after* setting DataItem?

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 02 Feb 2009, 07:30 AM
Hello Brad,

Basically DataItem has meaning in context of DataBinding. Thus on UpdateCommand DataItem is empty.  Below link demonstrates how you can use custom user control in RadGrid edit form:

Updating values using UserControl
Automatic insert, update and delete with UserControl edit form for the grid
User control edit form

Regards,
Nikolay
the Telerik team

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