rss2363 0 Newbie Poster

I'm trying to write out animals from a database. All the samples I see for creating View pages have hard-coded "nodes" in the URLs, but since I'm reading my data from a database, I don't know all the "nodes".

I can get my first view to work but my second one doesn't write out the correct URL to go to the third one. So, for example, I want my URLs to be:

/animals/
/animals/canines/
/animals/canines/schnauzer


I have the default route setup:

routes.MapRoute( _
             "Default", _
             "{controller}/{action}/{id}", _
             New With {.controller = "Home", .action = "Index", .id =
 UrlParameter.Optional} _
         )

The first URL works great and I can list the animal groups on the first one along with the correct links to the second URLs. I do that as follows:

for each animal in model
     Html.ActionLink(animal.animal_name,animal.animal_name.Trim) 
next

For some reason, by simply adding the animal_name as the link, it concatenates it onto the current path.

I also can get the canine groups written out on the second (so I know my model is working), however the URL.Action on that second "canines" page loses the "canines" in the URL so it renders as:

/animals/schnauzer

In this case, it isn't adding the node on to the end of the URL, it is replacing the last node. I've tried every way I can think of to write out the link including:

<a href="<%= url.action(canine.dog_name.Trim)) %>">
    <a href="<%= Url.Content("~" & url.action(canine.dog_name.Trim)) %>">

and a few others that aren't worth showing. :)

... I'm guessing I'm missing something in a route path but what is it? It can't be that I have to know the path I'm at on every page in order to write out the URL - can it?

Thanks in advance for your help!