November Happy Hour will be moved to Thursday December 5th.

Passing in values when rendering blocks

Vote:
 

We have a block which in the view has a div class which requires an ID. E.G:

Some content inside my block

The block sits in a content area which is rendered from it's parent view using

Html.PropertyFor().

My question is, that block1 id needs to increment in the view for each block - what's generally the best practice to achieve this?

#176200
Mar 13, 2017 18:38
Vote:
 

Hi James,

You may build your own ContentAreaRenderer to control the surrounding divs, check this: http://blog.tech-fellow.net/2015/06/11/content-area-under-the-hood-part-3/

Or use this AddOn if you use Bootstrap

https://github.com/valdisiljuconoks/EPiBootstrapArea

Regards

#176207
Mar 13, 2017 21:18
Vote:
 

This is perfect sample on how to use block's ID to add it to the wrapping elements: http://blog.tech-fellow.net/2015/09/07/create-episerver-site-menu-out-of-block-driven-content/

It was needed for generating menus out of page content.

Luc, that package has nowadays pretty much nothing in common with Bootstrap ;)

#176209
Mar 13, 2017 22:21
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.