@Html.DeleteConfirmation in a Plugin View (Admin) in asp.net core 2.0

247 views Asked by At

Looking at core code examples of say... Edit Action for SpecificationAttribute. I am looking to replicate this delete function in the same manner in my plugin, however, getting an error.

Getting this error

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

I have used in 3.90 but it getting error in 4.0 asp.net core Has anyone used @Html.DeleteConfirmation in a plugin (on administration side) that could give me a clues

I have a span element in the html like the following;

<span id="myattribute-delete" class="k-button">@T("Admin.Common.Delete")</span>

And trying to use @Html.DeleteConfirmation("myattribute-delete")

I know I probably need to double check my route, by the error is leading me to think the issue is not a routing issue.

1

There are 1 answers

1
Divyang Desai On BEST ANSWER

As @Stephen stated it's not part of MVC, and it's custom helper by nopCommerce.

@Html.DeleteConfirmation is helper till/in nopCommerce 3.90, but in 4.0 it has been changed to

<nop-delete-confirmation asp-model-id="@Model.Id" asp-button-id="myattribute-delete" />

And that helper located at Nop.Web.Framework.TagHelpers.Adminso you have to add reference of it to your view file.