15.6 Defining Custom Segment Variables; Listing 15-17. The Contents of CustomVariable.cshtml File

chap15
Jason Zhu 2021-11-23 21:16:29 +11:00
parent 98748c4b3d
commit e7f13be7d8
2 changed files with 19 additions and 1 deletions

View File

@ -104,6 +104,7 @@
<Content Include="Views\web.config" /> <Content Include="Views\web.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<Content Include="Views\Shared\ActionName.cshtml" /> <Content Include="Views\Shared\ActionName.cshtml" />
<Content Include="Views\Home\CustomVariable.cshtml" />
<None Include="Web.Debug.config"> <None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon> <DependentUpon>Web.config</DependentUpon>
</None> </None>
@ -115,7 +116,6 @@
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
<Folder Include="Models\" /> <Folder Include="Models\" />
<Folder Include="Views\Admin\" /> <Folder Include="Views\Admin\" />
<Folder Include="Views\Home\" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>

View File

@ -0,0 +1,18 @@

@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Custom Variable</title>
</head>
<body>
<div>The controller is: @ViewBag.Controller</div>
<div>The action is: @ViewBag.Action</div>
<div>The custom variable is: @ViewBag.CustomVariable</div>
</body>
</html>