对于我的自定义分页,我想在查询(过滤)
中添加一个int数组我在视图中的代码:
@foreach(var page in ViewBag.pagination){
string index = Convert.ToString(page.index);
if (page.skills != null)
{
<li>@Html.ActionLink(index, "index", "vacancy", new { skills= string.Join("&skills=", page.skills)}, null)</li>
}
else
{
<li>@Html.ActionLink(index, "index", "vacancy", new {page = page.index}, null)</li>
}
}
这一行
<li>@Html.ActionLink(index, "index", "vacancy", new { skills= string.Join("&skills=", page.skills)}, null)</li>
结果为:?技能= 1%26skills%3D2
但是如何将查询字符串更改为:?skills = 1&amp; skills = 2?
答案 0 :(得分:1)
您可以使用此
<li>@Html.ActionLink(index, "index", "vacancy")+"?"+string.Join("&", page.skills.Select(s=>"skills="+s)))</li>