Dynamic Design ASP.NET MVC

I recently started to learn ASP.NET Model View Controller (MVC) . This is a very unique approach that is required for sites, I notice the potential with the help of dynamics . This will greatly improve the service.

But I see how overuse of dynamics can be bad, especially if you deviate from strongly typed model . So my question is this ...

I am creating a layout, but I would like the layout to be fluid . I want the design to be easily changing without affecting my logic. I know that you can create Master Pages and Master Content Pages , which can contain most of the layout for convenience. In addition, I will still have restrictions for my use.

Is there a way to change these Master Pages and Master Content Pages into true dynamic objects? Essentially, designer can use what you see, what you create, I create, which allows you to change the whole site?

My initial thought was to save to create a dynamic layout where each View referenced a database; no matter which of these variables would create the layout. But I'm not sure if this is the best approach?

Any suggestions or thoughts for a better approach?

Please, I am not going to start a discussion, but if people could show me the direction in which I can explore this implementation method, it will be very useful. That way I can find the best solution that will fit these projects for dynamic layout .


Update:

To give an idea of ​​this project, my company has several subsidiaries. These subsidiaries will use the application, but would like it to be specific to a particular company. To avoid excessive design mockups, I would like to abstract this part.

Thus, my logic will not be affected, but the software will be modular enough to meet all the needs of our subsidiaries without having to configure each of them or jeopardize the constructor that affects logic .

Thank you for your help.


Update:

To help clarify, the goal is to allow the User Interface be separate from the application. In a regular Windows Application I would use Inversion Of Control to help separate the interface and structure from the original logic.

This untied approach is useful, the goal is to separate the interface in this case, Razor Syntax , which will create the structure. If you have a website:

 <html> <div id="Page-Container"> <div id="Header" /> <div id="Content" /> <div id="Footer" /> </div> </html> 

This structure will be static, but in my case I would like it to be dynamic . Thus, my logic can be abstracted through the structure, but the designer can manipulate and modify the page layout , but he would like to.

+4
source share
3 answers

I'm not sure that I understand your requirements exactly ..... but maybe the following premise will be interesting?

 @model CompanyName.LayoutModel <html> <body> @foreach(string view in Model.Views) { @Html.Partial(view); } </body> </html> 

This will depend on how any user interface infrastructure works. The idea is that you present a Razor object that simply contains a collection of views that Razor then partially displays. OK.

Instead of using ASP.NET MVC for the primary service, you may need to examine sites such as http://www.google.com/ig , they use ajax to read custom layouts for users (if you edit your settings on the home page, you can fully customize the layout and what news you get on the home page), and then fill these layouts with data from further ajax calls.
It sounds more flexible to me, each of these AJAX calls can be in ASP.NET MVC methods (which return the output of razor pages), and javascript can just paste the HTML directly into the DOM. It also gives you more flexibility when invoking methods that may take longer to execute or rely on third-party communication, as it allows you to easily β€œload” the animation and report errors.

+1
source

It looks like you are looking for some kind of CMS. There is already a bunch of CMS build for ASP.NET MVC , however you can create your own that will satisfy all your needs by storing views in the database. In this case, this article may point you in the right direction.

+1
source

In a razor, you can easily do this. You must have a model for your layout template and link it in a razor layout. Each part of the layout can be in the @if razor @if , which checks the fields of the model and dynamically creates each part.

0
source

All Articles