Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dean Pearson 2 posts 82 karma points
    Feb 04, 2019 @ 10:31
    Dean Pearson
    0

    Creating a search controller as part of a project and have created the controller and model in the appropriate folders.

    Within my search.cshtml file I have declared:

    @using OptometrySite.Controllers;
    @using OptometrySite.Models;
    

    and within the controller and model I have:

     namespace OptometrySite.Controllers
     { .....
     }
    

    Error I am getting upon entering a term for search is:

    CS0246: The type or namespace name 'OptometrySite.Controllers' could not be found (are you missing a using directive or an assembly reference?)

    Can anyone provide some help as to why Umbraco is making me pull my hair out with this :P It would be great to get it working.

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Feb 04, 2019 @ 12:46
    Dan Diplo
    100

    This functionality isn't really anything to do with Umbraco, but just standard ASP.NET MVC.

    May seem like a really obvious point, but have you actually built the Controllers and have the DLLs in the main websites /bin/ folder? It's sometimes easy to overlook (maybe a compilation error prevented it).

    NB. You can also add namespaces into the <namespaces> element within the web.config file in the root of the /Views/ folder. These get imported into every view.

  • Dean Pearson 2 posts 82 karma points
    Feb 04, 2019 @ 15:05
    Dean Pearson
    0

    Thanks Dan, I actually managed to get this sorted and embarrassingly I hadn't added them to the project and to think I call myself a developer :P Well seeing as it's Monday I will let myself off.

    Thanks for your reply though! :)

Please Sign in or register to post replies

Write your reply to:

Draft