i want to get string text of assigned property name? for example: I have a TagHelper:
public class CustomControl: TagHelper
{
[HtmlAttributeName("Items")]
public IEnumerable<object> DataItems { get; set; }
public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
string stringText=datatitems.GetType()??? //it should result "listDataBC"
}
then used on any page :
<customcontrol Items="listDataBC"/>
Thank you
You could use the
ModelExpression
as parameter and use "@listDataBC" to get the name and values.CustomControl.cs
Index.cshtml
Test result