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

Edit entity in dropdown column

1 Answer 63 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bobby Ross
Top achievements
Rank 1
Bobby Ross asked on 16 Mar 2011, 08:32 PM
Hello,

I have a scenario where I need to have cell text to display one databound field from an entity property, but when in edit mode I would like to use a dropdownlist to change the underlying entity itself and not the value being displayed.

For example my entity in simple terms is as follows:

Vehicle (Main databound entity)
-- Vehicle.Make (relates to Make entity)
-- Vehicle.Model (relates to Make entity)
-- Vehicle.Year (relates to Year entity)
-- Vehicle.Region (relates to Region entity)

Make
-- Make.MakeID
-- Make.MakeName

Model
-- Model.ModelID
-- Model.ModelName

Year
-- Year.YearID

Region
-- RegionID
-- RegionAbbr
-- RegionFullName

I would like to have for example a Region column that displays Region.RegionAbbr in the cell text, but when entering edit mode give a list bound to Region enities.  These entries should be bound to a List<Region> and displaymember should be set to RegionAbbr for display purposes.  When an entity is selected from the dropdown, instead of altering Region.RegionAbbr I would like to intercept the change and assign the Dropdownlist DataBoundItem to the Vehicle.Region entity.

Can this be done?

1 Answer, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 22 Mar 2011, 10:18 AM
Hello Bobby,

Thank you for writing.

I am not completely sure about your requirement, but it looks like a classical data-bound scenario. If this is the case, you can use the standard GridViewComboBoxColumn or GridViewMultiComboBoxColumn to implement drop-down editor with value and display members. For more details, please refer to our product documentation.

If this does not help, please open a new support ticket and send me a small sample project, which demonstrates your scenario along with detailed description of your goal. This will allow me to investigate further and provide you with accurate assistance.

Best wishes,
Martin Vasilev
the Telerik team
Tags
GridView
Asked by
Bobby Ross
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or