Timeline for How to change the source from an image field programmatically?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 21, 2017 at 22:20 | comment | added | Nathan Hase | @George I updated the answer to give some detail on supporting custom field types in Experience Editor. I hope that helps! You can always use the built-in image field type and write the source logic to use its default behavior when custom behavior is not necessary. | |
Jun 21, 2017 at 22:18 | history | edited | Nathan Hase | CC BY-SA 3.0 |
update to include some detail on supporting Experience Editor for custom field types.
|
Jun 21, 2017 at 20:17 | comment | added | George | I am trying to render the image with this way(@Html.Sitecore().Field("My Field Name")) with no luck. Is there any other configuration for the new created custom Image Field Type to work and render like the default Image field type? Should I do extra work in Custom Image Field class even if it is inherited from the Sitecore.Shell.Applications.ContentEditor.Image, for example is it needed to add some code in onPrerender method? | |
Jun 19, 2017 at 12:35 | comment | added | Nathan Hase | How are you rendering the image? If this is MVC you can render a field like this: @Html.Sitecore().Field("My Field Name") // optional overloads are available to pass in the context object if necessary. Or you can use Glass @Editable | |
Jun 19, 2017 at 6:09 | comment | added | George | Thank you for your answer. I have tried your approach but in Experience Editor the image field does not rendering properly. The img tag is rendering with only a media id attribute, no src attr even if i assign image. | |
Jun 13, 2017 at 14:23 | history | answered | Nathan Hase | CC BY-SA 3.0 |