I have a ViewComponent and I need to pass more than 4 values to the ViewComponent, but when I try, it's giving me the error below.
Error CS0746 Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.
Code looks like this.
public async Task<IViewComponentResult> InvokeAsync(
string A, string B, string C, string D, string E)
{
}
Calling the ViewComponent
@await Component.InvokeAsync(
"ViewComponent2",
new { A = Model.A, filter = "B", C = Model.C, Model.D, "2" })
I will use TagHelper to pass the data and is there any way to pass a model to the ViewComponent, I have tried but the parameter is always null.