.Net 3 Flashcards

1
Q

What is the purpose of _ViewImports.cshtml file?

A

In this file you can summarize (abstract) all using statements that you commonly use in all your views.

It is automatically imported into all views in the folder it belongs to and its subfolders. So if it is in View folder, then all your views will be affected.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the purpose of _ViewStart.cshtml file.

A

The common practice for ViewStart is to set up a default value that you can override for the Layout and the ViewData / ViewBag dictionary.

For example you can set default layout for all the views in the folder.

@{
Layout = “_Layout”;
}

It is automatically imported into all views in the folder it belongs to and its subfolders. So if it is in View folder, then all your views will be affected.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is @RenderBody in _Layout.cshtml

A

It’s where the view, that uses this layout (child view), will be rendered.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to inject a partial view?

A

Using tag <partial></partial>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is specific of _ViewStart.cshtml for partial views?

A

Unlike MVC view or page rendering, a partial view doesn’t run _ViewStart.cshtml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly