layout

Using Partial Views - ASP.NET MVC Demystified

When I was writing applications in WebForms (which, thankfully, I no longer do) I often ended up used .ascx files, commonly known as User Controls. Once I moved to MVC, I had to get used to a similar (though not the same) concept: Partial Views. In this tutorial, we'll walk through a use case for Partial Views and explain what they are and why we need to use them. We'll also walk through the two different render methods: @Html.Partial(... Read more >

What are Layout, _ViewStart, RenderBody, and RenderSection in MVC?

One of ASP.NET MVC's core principles is Separation of Concerns, the idea that different sections of the code are responsible for different things, and their responsibilities don't overlap. This allows MVC to be very change-tolerant, as changes in the Views really shouldn't affect the Model, since they have different concerns. This paradigm is reflected nicely in the way MVC uses layouts and sections. The architecture is set up so as to separate content from layout, and allow both to... Read more >