I have a Page Template where Region and Entities exists. I want to get an attribute value in EntityModel in a PageTemplate and render it.
I had kept the variable in request,page scopes but was not successful.
Is there anyway we can accomplish it.
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 community
The Page View has access to the Page Model, which contains the Region Models, which in turn contain the Entity Models.
That means that a Page View has direct access to al the Entity Models on the Page. For example, to access the first Article in the "Main" Region:
var article = (Article) Model.Regions["Main"].Entities.
Theoretically, you could render everything in a Page View (and not use Region or Entity Views at all), but it is good practice to delegate rendering to Region/Entity Views.
Note that Region and Entity Views render in a rather isolated manner, but since DXA 1.6, you can also access context the Page Model from a Region or Entity View.