MVC Field Rendering
If you're using Sitecore MVC for web development, use Sitecore MVC field rendering helpers to output Bynder DAM fields in Razor views. The connector extends Sitecore's renderField pipeline for DAM field types, so selected Bynder assets and derivatives can be rendered through the standard @Html.Sitecore().Field(...) helper.
Render selected field value
Use this for fields where the selected file or link already determines what should be rendered, such as Image [DAM, Single file] and General Link [DAM].
<!-- Rendering for a "Image [DAM, Single file]" and "General Link [DAM]" field
(has the derivative specified in the field value) -->
@Html.Sitecore().Field("Logo")Render image fields with a derivative
Use the derivative parameter for Image [DAM, Single asset] and Image [DAM, Multi asset] fields. The connector uses this derivative name to find the file that should be rendered for each selected asset.
<!-- Rendering for a "Image [DAM, Single asset]" and "Image [DAM, Multi asset]" field
(specifies a specific derivative to render) -->
@Html.Sitecore().Field("Logo", new { derivative = "webimage" })Override alt text metaproperty
By default, image rendering uses the field configuration's alt text metaproperty. You can override that per rendering by passing altProperty.
@Html.Sitecore().Field("HeroImage", new { derivative = "webimage", altProperty = "alt_text" })Add HTML attributes
Additional rendering parameters are passed through as HTML attributes. Underscores are converted to hyphens, so data_asset_source becomes data-asset-source.
@Html.Sitecore().Field("HeroImage", new {
derivative = "webimage",
@class = "hero-image",
loading = "lazy",
data_asset_source = "bynder"
})Render video fields
For Video [DAM] fields, pass a public video derivative. If no derivative is provided, the connector tries original.
@Html.Sitecore().Field("Video", new {
derivative = "mp4",
controls = "controls",
preload = "metadata"
})Render DAM general links
General Link [DAM] fields are handled by Sitecore's link field rendering pipeline, extended for the DAM link field types.
@Html.Sitecore().Field("DownloadLink")These examples apply to Sitecore MVC rendering. For JSS and Layout Service rendering, see Headless Rendering.