开发者

Spark engine without master page

开发者 https://www.devze.com 2022-12-26 18:24 出处:网络
I use application.spark file for master page In my app i have login page that does not need master page

I use application.spark file for master page In my app i have login page that does not need master page

I tried remove master page from my login page using this tag , but it continue to use application.spark

I can fix it by adding new master page in layout folder with name b开发者_如何学编程lank.spark file without any code and in my login page put this tag .

looks too ugly, so I'm asking you if you know another option to fix this issue?

I'm using: Spark-1.1.39975.0-release


In your controller action, return PartialView instead of View, and the Application.spark layout will be ignored.


At the top of the spark page, add:

 <use master="" />

Make sure you also do a clean build to clean up anything from previous builds to pick up the empty master page selection.


There are several ways to select a which master layout file should be used. The following are the ways a template may be selected, from weakest to strongest.

An Application.spark file in the Views/Layouts folder or Views/Shared folder This is the most general-purpose way to have a site-wide master template. It will not be used if the controller returns a PartialView().

A .spark file in Views/Layouts or Views/Shared with the same name as the controller For example if you have an AccountController you could have a Views/Layouts/Account.spark file which is used on that controller, but all other controllers use the Views/Layouts/Application.spark template.

Naming the master layout as the second argument when you return a View() as the ActionResult This gives the selection of layout to the controller, which some people may believe isn't necessarily a concern for the controller. What'cha gonna do? If this is present it will override the first two conventions.

Naming the master layout as an element in the view. This is actually the strongest mechanism available for wrapping a view in a layout file. It will override the conventional forms of master selection, and it will cause the name of the master in the View() ActionResult to be ignored if it's present.

Source : http://sparkviewengine.com/documentation/master-layouts

0

精彩评论

暂无评论...
验证码 换一张
取 消