'IHtmlHelper<dynamic>' does not contain a definition for 'Widget' in nopcommerce 4.0

1.1k views Asked by At

I am getting the red line and shows the title error when I add

@Html.Widget("home_page_top") and

@Html.Action("TopicBlock", "Topic", new { systemName = "HomePageText" })

in nop.web Home view in nopcommerce. And the full error shows the following message i.e. :

Error CS1061 'IHtmlHelper' does not contain a definition for 'Widget' and no accessible extension method 'Widget' accepting a first argument of type 'IHtmlHelper' could be found (are you missing a using directive or an assembly reference?)

2

There are 2 answers

1
karan On

I got the solution. I am going in a wrong way I am doing code 3.8 in 4.0. Thats why I am getting this issue.

0
CodeNoob On

In case anyone else comes across this question, in version 4.0 the code for adding a widget zone has changed. Use this :

@await Component.InvokeAsync("Widget", new { widgetZone = "custom_widget_zone" })