Table of Contents

Class RazorView

Namespace
System.Web.Mvc
Assembly
System.Web.Mvc.dll

Represents the class used to create views that have Razor syntax.

public class RazorView : BuildManagerCompiledView, IView
Inheritance
RazorView
Implements
Inherited Members

Constructors

RazorView(ControllerContext, string, string, bool, IEnumerable<string>)

Initializes a new instance of the RazorView class.

public RazorView(ControllerContext controllerContext, string viewPath, string layoutPath, bool runViewStartPages, IEnumerable<string> viewStartFileExtensions)

Parameters

controllerContext ControllerContext

The controller context.

viewPath string

The view path.

layoutPath string

The layout or master page.

runViewStartPages bool

A value that indicates whether view start files should be executed before the view.

viewStartFileExtensions IEnumerable<string>

The set of extensions that will be used when looking up view start files.

RazorView(ControllerContext, string, string, bool, IEnumerable<string>, IViewPageActivator)

Initializes a new instance of the RazorView class using the view page activator.

public RazorView(ControllerContext controllerContext, string viewPath, string layoutPath, bool runViewStartPages, IEnumerable<string> viewStartFileExtensions, IViewPageActivator viewPageActivator)

Parameters

controllerContext ControllerContext

The controller context.

viewPath string

The view path.

layoutPath string

The layout or master page.

runViewStartPages bool

A value that indicates whether view start files should be executed before the view.

viewStartFileExtensions IEnumerable<string>

The set of extensions that will be used when looking up view start files.

viewPageActivator IViewPageActivator

The view page activator.

Properties

LayoutPath

Gets the layout or master page.

public string LayoutPath { get; }

Property Value

string

The layout or master page.

RunViewStartPages

Gets a value that indicates whether view start files should be executed before the view.

public bool RunViewStartPages { get; }

Property Value

bool

A value that indicates whether view start files should be executed before the view.

ViewStartFileExtensions

Gets or sets the set of file extensions that will be used when looking up view start files.

public IEnumerable<string> ViewStartFileExtensions { get; }

Property Value

IEnumerable<string>

The set of file extensions that will be used when looking up view start files.

Methods

RenderView(ViewContext, TextWriter, object)

Renders the specified view context by using the specified writer and WebViewPage instance.

protected override void RenderView(ViewContext viewContext, TextWriter writer, object instance)

Parameters

viewContext ViewContext

The view context.

writer TextWriter

The writer that is used to render the view to the response.

instance object

The WebViewPage instance.