Adding Custom Routes

Topics: Developer Forum, User Forum
Jan 30, 2009 at 3:22 PM

I have a search page that is an N2 CMS page. I have a class responsible for paging that builds its paging URLs using a RouteValueDictionary. For example this line should give me a paging control:

<%= Html.Pager(ViewData.Model.PageSize, ViewData.Model.PageNumber, ViewData.Model.TotalItemCount, new { q = ViewData["SearchQuery"] } )%>

However, when the page is rendered, the page controls have the wrong URLs.

My search controller has an Index method:

public ActionResult Index(string q, int? p)

And if I try to build a link to this controller action like this:

<%=Html.ActionLink("Test", "Index", new { q = "SearchQuery", p = 1 })%>
or this:
<%= Html.BuildUrlFromExpression<SearchController>(c => c.Index("SearchQuery", 1))%>

All I get is a URL with no parameters:


I guess this is something to do with not having the correct routes set up? Any help would be appreciated!

Feb 1, 2009 at 9:33 PM
I found that the content route is more greedy than it should. I'll look into it.
Feb 1, 2009 at 9:33 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.