New Widget Zone

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years 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
4 years 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
4 years ago
Many thanks Anton,

Your solution worked great.

Kind regards
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.