0

Can someone please guide me to where I can find a collection of ASP MVC sample layout/pages.

I'm looking to learn the ASP MVC layouts, and looking for some examples of different layouts. Also, can you help/answer in understanding when to use sections and when to use partial views, views - what is the correct/recommended hierarchy in this?

I want to have a master page layout (shared, if I understand this correctly), and want to simply use the models as controls that I can reuse in multiple pages. Do I use partial views, views or sections for this?

tereško
  • 58,060
  • 25
  • 98
  • 150
aroos
  • 505
  • 2
  • 5
  • 12

3 Answers3

1

Partial Views are appropriate for content that can be shared directly without structural changes. Sections however are for content that must be overrriden in each specific view. It means that each view must define the content for the section

TGH
  • 38,769
  • 12
  • 102
  • 135
  • Thanks, I couldn't find when to use which. So, if I understand correctly. Partial view -> semantic content; while sections are overridden content with controls? – aroos Jun 23 '13 at 20:12
1

Check the following Scott Gu's blogs regarding this:

Layouts with Razor

Layouts and Sections with Razor

Mikhail
  • 9,186
  • 4
  • 33
  • 49
  • I looked at this, while it explains layouts and sections. It doesn't tell me when to use which. I looked at another application the MVC store, they use sections loosely, where I thought the could use views. So I was asking. – aroos Jun 23 '13 at 20:20
0

I finally found a collection of MVC layouts

Also, I see this request/question was asked previously in a different form.

The link below on codeplex has a collection, if anyone is looking for sample layouts. Not all the collections compile.

https://mvccontribgallery.codeplex.com/

Community
  • 1
  • 1
aroos
  • 505
  • 2
  • 5
  • 12