I would like to get the current url and add an extra parameter to the url (e.g. id = 1)
I defined a route:
routes.MapRoute( "GigDayListings", // Route name "gig/list/{year}/{month}/{day}", // URL with parameters new { controller = "Gig", action = "List" } // Parameter defaults ); In my view I have a helper that executes the following code: // Add page index _helper.ViewContext.RouteData.Values["id"] = 1; // Return link var urlHelper = new UrlHelper(_helper.ViewContext); return urlHelper.RouteUrl( _helper.ViewContext.RouteData.Values);
However, this does not work.
If my original URL was: gig / list / 2008/11/01
I get
gig / list / year = 2008 &? Month = 11 & day = 01 & ID = 1
I would like the url to be: controller / action / 2008/11/01? ID = 1
What am I doing wrong?
Rick
source share