Adding a css class to the wrapping div of all ContentAreas


Hi, I want to add a CSS class to the wrapping div of all ContentAreas. To do this with one ContentArea is easy:

@Html.PropertyFor(m => m.MainContent, new { cssClass="contentArea"})

The problem with this solution that I have to add this to all content areas in all views. Is there a better way to do this?

Sep 24, 2018 9:40

You can write your own handler that rendering the content area. (

Read more about it here in the blog by the great @valdis!

Sep 24, 2018 12:25
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.