I’m writing web application using razor view engine. In Visual Studio I got the chance by RightClicking “Views”-Folder in project-explorer to create a view using a wizard. I can check “Create strong typed view”, select a model-class and template (e.g. Empty, List, Create, Delete, …). Nice thing.
I wonder how I can edit the templates (change language, css styles, …).
The default create-Template looks like this:
@model UsedModel
@{
ViewBag.Title = "DefaultTemplate";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>DefaultTemplate</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>UsedModel</legend>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
So how can I customize this template?
Thanks in advance
Tobi
Here is a SO question that has the answer I believe you are looking for:
How do I edit default Razor Creat/Edit scaffolding in Visual Studio 2010
You can either copy the T4 files to your project and edit them (recommended) or modify them in place for all projects to use (I recommend against this).