简体   繁体   中英

Is it possible to pass information through a child template to a master template on Umbraco?

I have a Master Template and 2 Children Templates . I want to pass information from the children to the Master Template (each child template is a different page).

Is it possible? I'm using UmbracoCms version 7.7.4.

You're thinking they're templates, but in the end, they're a View and a PartialView from ASP.NET MVC. Thinking as ASP.NET MVC, there're 2 options:


The first one is to use Section and RenderSection .

Child: @section NameOfSection { parameterValue }

Parent: @RenderSection("NameOfSection", false)


The second one is to pass information from HttpContext, but then you'll have to call the ChildAction before use the variable in the ParentView (notice it's a bad design , you should avoid it). You can see more information here: Passing data from Partial View to its parent View

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM