Asp.net mvc 在Razor中创建EditorTemplates时出错

Asp.net mvc 在Razor中创建EditorTemplates时出错,asp.net-mvc,telerik,asp.net-mvc-3,razor,editortemplates,Asp.net Mvc,Telerik,Asp.net Mvc 3,Razor,Editortemplates,我在ASP.NET MVC 3中有一个运行良好的ascx编辑器模板,并尝试将其转换为razor: Ascx: 我做错了什么?Razor EditorTemplates难道不被ASP.NET MVC识别吗?请确保您不是旧版本的Telerik控件,这些控件可能不会根据ASP.NET MVC 3.0(System.Web.MVC 3.0程序集)进行编译。另外,请确保您已经遵循了必备步骤。Razor视图不能从ViewUserControl继承。 相反,您只需要指定Razor视图的模型: @model I

我在ASP.NET MVC 3中有一个运行良好的ascx编辑器模板,并尝试将其转换为razor:

Ascx:


我做错了什么?Razor EditorTemplates难道不被ASP.NET MVC识别吗?

请确保您不是旧版本的Telerik控件,这些控件可能不会根据ASP.NET MVC 3.0(System.Web.MVC 3.0程序集)进行编译。另外,请确保您已经遵循了必备步骤。

Razor视图不能从
ViewUserControl
继承。 相反,您只需要指定Razor视图的模型:

@model Inventory.Models.ProductCategory

@(Html.Telerik().DropDownList()
      .Name("ProductCategory")
      .BindTo(new SelectList((IEnumerable)ViewData["ProductCategories"], "Id", "Name"))   ) 

几天前我发布了Telerik的最新版本。它支持Razor语法。此外,您的代码和我的代码在功能上是相同的,并且在尝试时不起作用:(哦!我完全错过了:|谢谢!:)是的,我两个。。只是花了一个小时和它搏斗。大D'oh!非常感谢;)
@inherits  System.Web.Mvc.ViewUserControl<Inventory.Models.ProductCategory>

@(Html.Telerik().DropDownList()
    .Name("ProductCategory")
        .BindTo(new SelectList((IEnumerable)ViewData["ProductCategories"], "Id", "Name"))
)
CS0115: 'ASP._Page_Views_Shared_EditorTemplates_ProductCategory_cshtml.Execute()': no suitable method found to override

Line 44:         }
Line 45:         
Line 46:         public override void Execute() {
Line 47: 
Line 48: WriteLiteral("\r\n");
@model Inventory.Models.ProductCategory

@(Html.Telerik().DropDownList()
      .Name("ProductCategory")
      .BindTo(new SelectList((IEnumerable)ViewData["ProductCategories"], "Id", "Name"))   )