如何使用剃刀布局母版页的ASP.NET MVC [英] How to use Razor Layout as Master Page in ASP.NET MVC

查看:115
本文介绍了如何使用剃刀布局母版页的ASP.NET MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.NET MVC 3,并有使用ASPX写了一些零件。
所以在我的一些看法我有这样的事情

I am using ASP.NET MVC 3 and have some parts written using aspx. So in some of my views I have something like this

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="Thread.Index" %>

不过,我已经使用Razor的布局站点上创建布局,我想用这个.aspx文件中的布局了。结果
我怎样才能做到这一点?

But I've already create Layout for site using Razor's Layout and I want to use that layout in this .aspx file too.
How can i achieve this?

推荐答案

您不能使用的WebForms意见剃刀布局。您将需要创建的WebForms意见的WebForms母版。查看发动机不能混用这样。

You cannot use Razor layouts with WebForms views. You will need to create a WebForms masterpage for WebForms views. View engines cannot be mixed like this.

这篇关于如何使用剃刀布局母版页的ASP.NET MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆