Vulnerability in EPiServer.Forms
Hello, it will be probably very basic question for EPi developersWhat I'd like to achieve is a MVC structure for:FrontPage Division1FrontPage Division2FrontPage Division3FrontPage Division4FrontPageEvery division page will be one page type, lets say: DivisionPage, which I'd like to have "header" tab in EditMode with properties like: Logo LogoTextI'd like my editors to have possibility to change logo and text next to logo for every division specifically.As far as I know all of those pages should have one _layout. How to make header from root layout for FrontPage to take values from DivisionPage model??? Can you suggest any solution?
If I understood you correctly - you should look other way around. Child page should "bubble up" necessary values to be displayed in layout page (theoretically you can also have multiple layout pages and each child page can specify which layout page to use - but that's I guess another topic).
One of the easiest way to achieve this is to use ViewData dictionary for instance. Child page will add their own values from their page instances to `ViewData` dictionary under specific keys and then layout page can reach these values and render in necessary placeholders.
Another approach would be to use `CurrentPage` approach. You can reach page currently being rendered via `IPageRouteHelper` interface. This guy has `Page` property that will point to the `PageData` object (this is base class for all pages). Problem with this approach is that you have to somehow extract values frorm the page. One way is to use "stringly typed" approach - `IPageRouteHelper.Page["LogoText"]` (which sucks). Another approach would be to cast this `PageData` to some known interface that only Division pages implement (e.g. IDivisionPage) and then if result != null (meaning that current page is DivisionPage, as there might be other pages "running through" layout page code) you can get values from that page via interface (which also sucks a bit, but less).