简体   繁体   中英

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

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 ie :

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?)

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.

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" })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM