In the DXA Example Site a RegionName
is set in the ViewBag
. Where is this defined?
\Site\Areas\Core\Views\Entity\Partials\Teaser-ImageOverlay.cshtml
if (ViewBag.RegionName == "Hero")
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It only takes a minute to sign up.
Sign up to join this communityIn the DXA Example Site a RegionName
is set in the ViewBag
. Where is this defined?
\Site\Areas\Core\Views\Entity\Partials\Teaser-ImageOverlay.cshtml
if (ViewBag.RegionName == "Hero")
The ViewBag.RegionName
contains a bit of context information for the view. It is populated by the DXA controllers, (see Sdl.Web.Mvc.Controllers.SetupViewData). It does not apply to page views and region views.
Which RegionName
is used is configured in the CT (component template) in the CMS, in the template metadata field Region Name
. If the Region Name
field is empty the default is the region view name (excluding module name) from the Region View Name
field.
The Core module uses the Viewbag.RegionName
in the partial view Teaser-ImageOverlay
(see source).
if (ViewBag.RegionName == "Hero")
RegionName
is set in the corresponding ComponentTemplate's RegionView
Field
RegionName
comes from the Region Name
field. Only when that is empty the Region View Name
is used.
– Jan H
May 4 '17 at 13:44
RegionName
is added to theViewBag
, why is that important exactly? – Bart Koopman May 4 '17 at 12:30