RouteValues传递IEnumerable的财产想象的对象定义如下:在ActionLink的
public class MyViewModel{
public List<string> MyList { get; set; }
}
在我看来,我有这个动作链接:
@Ajax.ActionLink("<", "Index", new MyViewModel() { MyList = new List<string>() {"foo", "bar"}}, new AjaxOptions())
的ActionLink的的HTML结果将是:
<a class="btn btn-default" data-ajax="true" href="/Index?MyList=System.Collections.Generic.List%601%5BSystem.String%5D"><</a>
我的问题是,如何得到这个结果:
<a class="btn btn-default" data-ajax="true" href="/Index?MyList=foo&MyList=bar"><</a>
不能仅仅使用带有方法GET和隐藏值的表单吗?这似乎比你的扩展更简单 – Shoe
是的,我可以,但我有4个链接/意见。使用帮手更“漂亮” – GGO