Pangolin
Pangolin

Reputation: 7444

How to use other Layout for page the _Layout.vbhtml in .net mvc 3 view

I want to use a different layout for all the Views in one folder. It's all my Panel views controlled by PanelController.vb

Function LogIn() As ActionResult
    Return View()
End Function

Currently all the views in my project utilize _Layout.vbhtml for the layout etc.

How can I make these specific pages utilize e.g. _PanelLayout.vbhtml instead of the default?

See below of what files I am talking about:

Screenshot

I am using Visual Studio 2010, .NET MVC 3, Pages are Razor or something like that.

Upvotes: 0

Views: 1985

Answers (2)

brianc
brianc

Reputation: 475

The question specifically calls for vbhtml (or vb.net) page. The accepted answer is for cshtml (C#) razor page. The correct answer for vb.net is:

@CODE
Layout ="~/Views/Shared/_PanelLayout.vbhtml"
End Code

Upvotes: 2

ipr101
ipr101

Reputation: 24236

You can define the view's layout file at the top of the view -

@{
    ViewBag.Title = "Index"
    Layout = "~/Views/Shared/_PanelLayout.vbhtml"
}

Upvotes: 2

Related Questions