Prabhat
Prabhat

Reputation: 802

How can I create layout page for partial views in asp.net MVC?

How to create one layout page for a partial view?

Simply in MVC we create _layout.html and configure in viewstart.html page for all view. But in this partial views case how I'll do?

If you know a good example, please provide it to me.

Upvotes: 2

Views: 561

Answers (3)

gemon01
gemon01

Reputation: 341

<partial name="_ButtonScroll" />

Upvotes: 0

dotnetguru
dotnetguru

Reputation: 26

You can't create layout page for partialview because partialview is same as user control in asp.net.

As per your requirement you can create one @RenderSection() and consume for every partialview page.

Upvotes: 1

Moloy Adhikary
Moloy Adhikary

Reputation: 67

As of I understand, you can't use a layout page for a partial view. The partial view is resides under a normal view and this view may have it's own layout page. No need of a layout page for the partial view.

If you decided to do so whatever the concept is: 1. Use a normal view to show the partial view. The normal view have no data except the partial view here. 2. Use your desired layout page for this normal view.

Upvotes: 0

Related Questions