As I am new to Umbraco, I have not quite understood the routing mechanisms it seems to have.
I have a custom surface controller myProject.Controllers.CompanySurfaceController
with a getCompanyList()
and getCompany(int companyId)
function.
The basic idea is to get the list of companies from the db, render the partial view with classic <a>
links to the getCompany(..)
function and retrieve/display that company from the db.
Everything is working fine except one thing: I cannot grasp how to create the <a>
links to the child action of the controller! I have no problem including child actions in partial views when POSTing and using Html.Action.
I have tried @Html.ActionLink
and other helpers but the closest I get to, is a link for /umbraco/Surface/CompanySurface/Company
, which doesn't work of course and it does not include the id parameter (e.g. Company/3
).
I have also tried to put the controllers in the umbraco/Surface
namespace without luck (and it does not seem necessary).
What am I missing here?
I ended up using the classic way of doing GET parameters instead. It works because i fetch all companies from the DB and handle everything in one controller (e.g. EditCompany). Then I can pass the
/EditCompany?companyId=xx
It is not pretty but it is only needed for secure pages so I do not worry about SEO for now.
If we really need to make this work with custom controllers we need to implement a custom IContentFinder in Umbraco instead.