创建EditorTemplates我在ASP.NET MVC 3完美的工作ASCX编辑模板,并试图将其转换为剃刀:错误剃刀
ASCX:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Inventory.Models.ProductCategory>" %>
<%= Html.Telerik().DropDownList()
.Name("ProductCategory")
.BindTo(new SelectList((IEnumerable)ViewData["ProductCategories"], "Id", "Name"))
%>
剃刀:
@inherits System.Web.Mvc.ViewUserControl<Inventory.Models.ProductCategory>
@(Html.Telerik().DropDownList()
.Name("ProductCategory")
.BindTo(new SelectList((IEnumerable)ViewData["ProductCategories"], "Id", "Name"))
)
我重命名了ascx,所以当ASP.NET选择编辑器模板时它不会发生冲突,我保存了带有cshtml扩展名的剃须刀文件。但在运行时,我得到这个错误:
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");
我在做什么错? ASP.NET MVC不支持Razor EditorTemplates吗?
D'oh!我完全错过了:|谢谢!:) – 2011-01-25 06:34:48