Skip to content

Editable where backing item fieldname is different #460

@Joentje71

Description

@Joentje71

Hello,

We have a shared partial view that does @Html.Glass().Editable(x => x.Title).
The Title property on the view's vm gets set from different fields for different Sitecore data templates.
For example, for a news component the Title is set with Title, but for a product component with ProductName.

Because the ID on the partial view's vm points to the correct Sitecore item, Glass can find the item to be edited.
But Glass can -of course- only find the correct field to be edited on the news item, NOT on the product item.

Is there a smart way to make the generic view update data template specific fields?
For example, have a property on the vm with the field name, so that the view can edit x -> x.ReferencedField?
Or is there another way this can / should be accomplished?

Thanks in advance!
Jeroen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions