November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi ZZ,
The recommended way is to use @Html.PropertyFor so I think you should go with this approach only.
The issue I am having is that I have to add this to each and every view of the page. And if some one create a new page then the person should remeber to add this line too ?
How can i do it explicitly for every page view ?
Thanks
depends on your scenario, but at the end in MVC world - markup that visitor receives is more or less in your own control. You can generalize local block generation either by inheriting from some base controller or implementing MVC filters or use any other mechanism to do it "transparently", but at the end - when it comes to "where should we render this block" - this is something that you have to specify. If this is something pretty global (like menu, headers, etc) - Layout is one of the place where this can be applied to every page on the site.
But in your case - apply this rendering logic to all classes that inherit this specific page, guess there is no automatic way to include local block in every child page's view.
We are trying to add some functionality to our exsisting website. In this regard we need a local block on every page. I have created a block and have added it as property on PageBase class, this is the class which is inherited by every page.
The problem i am having is how to render this block on every page without using @Html.PropertyFor(), on every page view.