New Widget Zone

8 months ago
Hi,

I'm having a few issues with adding a new widget zone within the _ProductReviewOverview.cshtml.
This is the markup:

@await Component.InvokeAsync("Widget", new { widgetZone = "review_scorecard", additionalData = Model.Id})


But I receive the following error:
One or more compilation failures occurred:
\Themes\PowerShop\Views\Product\_ProductReviewOverview.cshtml(20,130): error CS1061: 'ProductReviewOverviewModel' does not contain a definition for 'Id' and no extension method 'Id' accepting a first argument of type 'ProductReviewOverviewModel' could be found (are you missing a using directive or an assembly reference?)


Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occurred:
C:\inetpub\wwwroot\matakki.com\Themes\PowerShop\Views\Product\_ProductReviewOverview.cshtml(20,130): error CS1061: 'ProductReviewOverviewModel' does not contain a definition for 'Id' and no extension method 'Id' accepting a first argument of type 'ProductReviewOverviewModel' could be found (are you missing a using directive or an assembly reference?)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(RazorCodeDocument codeDocument, String generatedCode)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CreateCacheEntry(String normalizedPath)
--- End of stack trace from previous location where exception was thrown ---


Anybody be able to shed some light on this issue would be great

Kind regards

Nick
8 months ago
Hello,

The ProductReviewOverviewModel doesn't have a property "Id" so you cannot use the following code - "Model.Id".
I think you are trying to pass the product id to your widget's invoke method. If that is the case the ProductReviewOverviewModel has a property of ProductId which you can use. Try to replace the Model.Id in your code with Model.ProductId.

Hope that helps!

Regards,
Anton
8 months ago
Many thanks Anton,

Your solution worked great.

Kind regards