I would like to render view component inside pagemodel in onget method. When i try to execute the page I always get NULL REFERENCE ERROR. Can anybody help me with it. Here is the code i am using.
private readonly IViewComponentHelper _helper;
public MyPage( IViewComponentHelper helper)
{
_helper = helper;
}
public async Task<ActionResult> OnGet( string id,string type)
{
var result = await _helper.InvokeAsync(
"mycomponent",
new
{
id= id,
type = type
});
}