我使用 umbraco 7 mvc
我只是想在局部视图中渲染 umbraco 字段。不知道该怎么做。@CurrentPage 或 @Umbraco.Field 或 RenderMacro 等不起作用
我有以下部分观点
@model MvcImport.Models.ImportModel
@{
var formSent = false;
var success = TempData["Success"];
if (success != null)
{
bool.TryParse(success.ToString(), out formSent);
}
}
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@if (formSent)
{
<p>Thanks, we'll get back to you soon!</p>
}
else
{
using (Html.BeginUmbracoForm<MvcImport.Controllers.ImportController>("ImportExcel", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<div>
@Html.LabelFor(x => x.FileUpload)
@Html.TextBoxFor(x => x.FileUpload, new { type = "file", name = "Files" })
@Html.ValidationMessageFor(x => x.FileUpload)
</div>
<div>
@Html.LabelFor(model => model.FileType)<br />
@Html.DropDownListFor(model => model.FileType, Model.FileTypes)
@Html.ValidationMessageFor(x => x.FileType)
</div>
<input type="submit" value="Submit" class="btn-submit" />
}
}
我只是想更换
<p>Thanks, we'll get back to you soon!</p>
与当前页面字段,例如。
@currentPage.thankYouCopy
或者
@Umbraco.Field("thankYouCopy")
怎么做?
我在我的主视图中通过以下方式调用部分:
@Html.Partial("Import", new MvcImport.Models.ImportModel { FileTypes = fileTypes })
谢谢