在 shared/EditorTemplete 文件夹中定义视图在我的 asp.net mvc-4 网络应用程序上不起作用
Defining a View inisde the shared/EditorTemplete folder is not working on my asp.net mvc-4 web application
我正在开发 asp.net mvc-4 网络应用程序。现在我有以下视图模型 class:-
public class ServerJoin : CreateResource, IValidatableObject
{
public Server Server { get; set; }
public Resource Resource { get; set; }
}
创建资源class如下:-
public class CreateResource
{
public CreateResource()
{
this.operation = new Operation5();
this.createAccount = new CreateAccount();
}
public Operation5 operation { get; set; }
public CreateAccount createAccount { get; set; }
}
public class Operation5
{
public Operation5()
{
this.Details = new Details4();
}
public Details4 Details { set; get; }
}
public class Details4
{
public Details4()
{
this.RESOURCECUSTOMFIELD = new List<RESOURCECUSTOMFIELD>();
}
[HiddenInput(DisplayValue = false)]
public string RESOURCENAME { set; get; }
//code goes here....
现在我在主视图中有以下内容:-
@model S.ViewModels.ServerJoin
@Html.EditorFor(model=>model.operation.Details)
并且我在 Shared/EditorTemplete 文件夹下创建了一个名为 Details4.cshtml
的视图:-
@model S.ViewModels.Details4
@Html.EditorFor(model => model.RESOURCENAME)
@Html.ValidationMessageFor(model => model.RESOURCENAME)
现在我期望在我的 MAIN 视图中,以下 @Html.EditorFor(model=>model.operation.Details)
应该呈现在 EditorTemplete 中定义的名为 Details4.cshtml
的视图?但它没有?那么有人可以就此提出建议吗?
谢谢
是Shared/EditorTemplates
不是Shared/EditorTemplete
。
我正在开发 asp.net mvc-4 网络应用程序。现在我有以下视图模型 class:-
public class ServerJoin : CreateResource, IValidatableObject
{
public Server Server { get; set; }
public Resource Resource { get; set; }
}
创建资源class如下:-
public class CreateResource
{
public CreateResource()
{
this.operation = new Operation5();
this.createAccount = new CreateAccount();
}
public Operation5 operation { get; set; }
public CreateAccount createAccount { get; set; }
}
public class Operation5
{
public Operation5()
{
this.Details = new Details4();
}
public Details4 Details { set; get; }
}
public class Details4
{
public Details4()
{
this.RESOURCECUSTOMFIELD = new List<RESOURCECUSTOMFIELD>();
}
[HiddenInput(DisplayValue = false)]
public string RESOURCENAME { set; get; }
//code goes here....
现在我在主视图中有以下内容:-
@model S.ViewModels.ServerJoin
@Html.EditorFor(model=>model.operation.Details)
并且我在 Shared/EditorTemplete 文件夹下创建了一个名为 Details4.cshtml
的视图:-
@model S.ViewModels.Details4
@Html.EditorFor(model => model.RESOURCENAME)
@Html.ValidationMessageFor(model => model.RESOURCENAME)
现在我期望在我的 MAIN 视图中,以下 @Html.EditorFor(model=>model.operation.Details)
应该呈现在 EditorTemplete 中定义的名为 Details4.cshtml
的视图?但它没有?那么有人可以就此提出建议吗?
谢谢
是Shared/EditorTemplates
不是Shared/EditorTemplete
。