views:

538

answers:

1

why do i get the error " Expected class, interface, enum or struct" with string underlined?

 public static string IsSelected(this HtmlHelper helper, string A, string B)

    {
         return "wtf";

    }
+5  A: 

Your extension method needs to be inside a static class:

public static class MyExtensions
{
    public static string IsSelected( this HtmlHelper helper, string A, string B)
    {
        return "wtf";

    }
}
tvanfosson
that fixed one part, but it still is not registering as an extension with system.web.mvc.htmlhelpers. what else needs to be done?
zsharp
actually, i imported namespace in view and it workes, but should i have to do that?
zsharp
You can import the namespace in your web.config instead of the view itself.
Ben Robbins
thanks..details details...
zsharp