How can I set attribute to MVC2 user control defined in single file with content:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
I'm searching declarative solution. Something like this:
<%[DefaultProperty("Items")]%>
<%@ Control 开发者_开发知识库Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
Thanks.
You would need to create a new class that inherits from ViewUserControl
public class SpecialAttribute : Attribute { }
[Special]
public class MyUserControl : ViewUserControl
{
}
And then in your partial view you would use the Inherits attribute like this:
<%@ Control Language="C#" Inherits="MvcApplication1.CustomViews.MyUserControl" %>
精彩评论