【发布时间】:2015-09-23 15:49:28
【问题描述】:
我目前正在开发一个 ASP.NET Core 自定义标签助手。我需要从属性中读取一个复杂对象,如下所示:
[模型]
public class Page {
[HtmlAttributeName(page-size)]
public int size {get; set;}
}
public class MyControl {
public Page page {get; set;}
}
[TagHelper 类]
[TargetElement("MyControl", Attributes="page-size")]
public class MyControlTagHelper : TagHelper {
public Page page {get; set;}
//Here i have process methods.
}
现在我想在视图中获取页面大小值,如下所示:
<MyControl page-size="4"></MyControl>
我不知道该怎么做。到目前为止,我尝试将完整的复杂对象提供给属性as shown in this article。
如何将复杂对象的值读取为page-size?
【问题讨论】:
标签: c# asp.net-core asp.net-core-mvc tag-helpers