Building Anonymous type from querystring
I was wondering if anyone had experience dynamically building an anonymous type from a query string with the ability to exclude specifc values
For example:
Given the querystring resulting in a results screen ?t1=sadfasdf&t2=sdafasdfasdf&t3=sdfsadfasf&t4=dfasdfasdfI want to provide the following links
Action?t1=sadfasdf&t2=sdafasdfasdf&t3=sdfsadfasf&t4=dfasdfasdf
Action?t1=Suggestion&t2=sdafasdfasdf&t3=sdfsadfasf&t4=dfasdfasdf
Action?t1=sadfasdf&t2=Suggestion&t3=sdfsadfasf&t4=dfasdfasdf
but if an addtional p开发者_如何学JAVAarameter is added to the querystring, I would like the action links to automatically pass the value to the next action
You don't have to use an anonymous types to pass action parameters, that's a convenience. You can use a RouteValueDictionary
every mvc Action method has an overload that takes a RouteValueDictionary
instead, and you can get the current values from Url.RequestContext.RouteData.Values
精彩评论