I am using a RadListView to display items of three similar object types (Member, Position, Substitute), and use code-behind to show/hide fields within the templates depending on the type of the object. So far, I have view and edit working fine, using a UserControl that detects the object type,and updates the display accordingly. My problem occurs when I try to add.
I have three buttons on the form, one for adding each object type, firing different commands for each type - AddMember, AddPosition, AddSubstitute. When the command is fired, I create an empty object of the required type, and use the RadListView's ShowInsertItem
method with the object parameter overload.
My question is, how can I access this object from my asp.net markup, so I can pass it through to the UserControl that defines the fields to use?
In the EditTemplate, I can simply use something like:
Member="<%# (BaseMemberCommon)Container.DataItem %>"/>
However, in the InsertTemplate, the Container object doesn't have a DataItem property.
Can anyone help?