I want to iterate through table data and poupulate links in a table.
Each row in the table has links of a similar fashion with several different ids interspersed. I'd like to use the Url factory to generate a template for the url route.
eg.
var urlHelper = new UrlHelper(HttpContext.Current.Request...);
//code is a bit handwavy and may not compile
var routeValues = new Dictonary<string,object>();
routeData["action"] = "myAction";
routeData["controller"] = "myAction";
routeData["id1"] = "{0}";
routeData["id1"] = "{2}";
urlHelper.RouteUrl(routeValues);
MSDN REF UrlHelper.RouteUrl http://msdn.microsoft.com/en-us/library/dd505226(v=vs.118).aspx
I think when I currently use placeholders, it encodes the "{" signs and I havent really worked around it. I have seen a "{" in our project urls, so I would like to avoid decoding these charchters.
I'd also strongly prefer to avoid the solution of putting in myId1 = -9999, myId=-9999, myString='-9999', although this is an acceptable solution should it be nessecary.
Is there a good solution to generate routes with placeholders?