I am currently working on an ASP.NET Core custom tag helper. I need to read a complex object from an attribute as follows:
[Models]
public class Page {
[HtmlAttributeName(page-size)]
public int size {get; set;}
}
public class MyControl {
public Page page {get; set;}
}
[TagHelper class]
[TargetElement("MyControl", Attributes="page-size")]
public class MyControlTagHelper : TagHelper {
public Page page {get; set;}
//Here i have process methods.
}
And now I want to get the page size value in the view as follows:
<MyControl page-size="4"></MyControl>
I don't know to do this. So far, I tried to provide the full complex object to an attribute as shown in this article.
How can I read the complex object's values as page-size
?