Shared data in ASP.NET MVC Views

What is the best way to provide general data for my views?

For example, I want to be able to just put <% = Model.Title%> on my main page or something like that.

In this case, is it better to override the ViewPage classes that I need? Or just use a generic model object?

I'm currently trying to use a general approach to model objects — it works; just a lot of code and page views for editing ...

+3
source share
1 answer

You can put a ContentPlaceHolder on your MasterPage, and in the views you can put general data in it

+1
source

Source: https://habr.com/ru/post/1713121/


All Articles