Reputation: 171
I have a view:
@{
RouteValueDictionary tRVD = new RouteValueDictionary(ViewContext.RouteData.Values);
foreach (string key in sQS.Split('&'))
{
var itemArr = key.Split('=');
tRVD[itemArr[0]] = itemArr[1];
}
tRVD["dtLastRequest"] = item.dtLastRequest;
tRVD["uiSubscription"] = item.uiSubscription;
tRVD["area"] = "";
}
@Html.Action("Count", "Search", tRVD)
Which generate RouteValueDictionary with 15 keys & values, and then pass it to Action "Count", controller "Search", as i could think?!
I dont know previous programmer, who wrote this code, but controller's action code is full or work with Request.QueryString, but right now, QueryString is empty.
Is it really possible to pass tRVD to Action "Count" as QueryString? Now, i could get values from:
RouteData.Values
there are my keys and values, but i dont want to change code of previous coder and rewrite all from QueryString to RouteData.
Upvotes: 0
Views: 2064
Reputation: 6830
The query string is empty because the Count
action method is really invoked not using an ordinary request, specifying the action's parameters in the URL, but directly within the framework, carrying the parameters in the RouteData
object.
So you should access the parameters using RouteData
, as you wrote.
Upvotes: 1