[Plugin] Using an HtmlHelper Extension doesn't work

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hi Everyone,

I'm developing a simple plugin and i want to make use of the following HtmlHelper Extension:

MVC3 @Html.CheckBoxList() custom extension
http://www.codeproject.com/Articles/292050/MVC3-Html-CheckBoxList-custom-extension

I've tried using NuGet, and tried referencing manual to the downloaded DLL. But none of those methods work. This is the error i'm getting when i visit my view:


Error  631  'System.Web.Mvc.HtmlHelper' does not contain a definition for 'CheckBoxList' and no extension method 'CheckBoxList' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)  


using example code:

@Html.CheckBoxList("Cities",  
                   x => x.Cities,          
                   x => x.Id,              
                   x => x.Name,            
                   x => x.Region.Cities)


Does anyone knows how to solve this issue? I've copied the web.config from an existing plugin.

Kind Regards,
11 years ago
The error seems to indicate you are missing a using statment in your view


@using namespace


Where namespace should be replaced with the namespace of the HTML helper
11 years ago
keesjan wrote:
The error seems to indicate you are missing a using statment in your view


@using namespace


Where namespace should be replaced with the namespace of the HTML helper


Thx Keesjan for your quick response.

I don't think there is a namespace for this extension. I didn't find anything about namespaces in the documentation.

This plugin is just a simple extension of MVC class 'HtmlHelper', which is used for all Html helpers on MVC views. Since there is no supported CheckBoxList extension built into MVC, this plugin adds it.
11 years ago
Does it work when you put all the source code (of the HTML helper) in APP_CODE?
11 years ago
This is not the first time i've had this problem. I've also tried to add an reference to Ext.Net DLL, but with the same issue. Not recognized in the class library - view. In the controller of the plugin this works fine, using namespaces, and the DLL methods...

Has this something to do with web.config? My view is marked as an Embedded Resource.

Kind regards
11 years ago
Nesse wrote:
This is not the first time i've had this problem. I've also tried to add an reference to Ext.Net DLL, but with the same issue. Not recognized in the class library - view. In the controller of the plugin this works fine, using namespaces, and the DLL methods...

Has this something to do with web.config? My view is marked as an Embedded Resource.

Kind regards


I'm wondering if there are other developers who have similar problems using external dll references? Every time i'm trying to use a external component implemented by Nuget, problems occur in my plugin project.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.