【发布时间】:2011-10-05 21:44:56
【问题描述】:
我有一个 ViewModel,它是一个非常简单的过滤器对象,如下所示:
public class FilterViewModel
{
public String FilterTerm { get; set; }
public String FilterProperty { get; set; }
}
我希望做的是做一个从另一个页面到这个页面的路由链接,并将我的 FilterViewModel 传递到路由 url 创建到 RouteValues 中,如下所示:
Url.RouteUrl("myRoute", new { filter = new FilterViewModel() { FilterProperty = "Product", FilterTerm = _detail.FilterTerm }})"
瞧,另一边渲染的是
http://theurl?filter=Fully.Qualified.Namespace.FilterViewModel
我不知道我的预期,也许是像这样序列化到查询字符串中的东西:
http://theurl?filter=FilterProperty|Product,FilterTerm|ProductA
有没有办法做我想做的开箱即用的事情? (或不开箱即用)
【问题讨论】:
标签: asp.net-mvc-3 model-view-controller routedata