Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 多路径值_Asp.net_Web Services_Asp.net Mvc 2 - Fatal编程技术网

Asp.net 多路径值

Asp.net 多路径值,asp.net,web-services,asp.net-mvc-2,Asp.net,Web Services,Asp.net Mvc 2,我正在做一个项目,需要我对列表中的一列进行排序,而列表有几页长。目前,当我排序时,所有内容都正确排序,当我转到下一页时,它就是这样做的。我的问题是,一旦我排序并转到下一页,我就失去了排序值 我正在使用ActionLink Html helper方法生成我的页面链接,但是页面链接不包括最后一个链接中的路由值以进行排序。如何使ActionLink使用以前路由中的路由值?解决方案使用HttpContext.Current.Request属性 在标题部分(其中设置了排序),我添加了以下内容: <%

我正在做一个项目,需要我对列表中的一列进行排序,而列表有几页长。目前,当我排序时,所有内容都正确排序,当我转到下一页时,它就是这样做的。我的问题是,一旦我排序并转到下一页,我就失去了排序值


我正在使用ActionLink Html helper方法生成我的页面链接,但是页面链接不包括最后一个链接中的路由值以进行排序。如何使ActionLink使用以前路由中的路由值?

解决方案使用HttpContext.Current.Request属性

在标题部分(其中设置了排序),我添加了以下内容:

<%: Html.ActionLink("linkText", "actionName", new { sort = "sortingName", page = HttpContext.Current.Request["page"] })%>
<%: Html.ActionLink(i.ToString(), "actionName", new { page = i, sort = HttpContext.Current.Request["sort"]})

在分页部分,我添加了以下内容:

<%: Html.ActionLink("linkText", "actionName", new { sort = "sortingName", page = HttpContext.Current.Request["page"] })%>
<%: Html.ActionLink(i.ToString(), "actionName", new { page = i, sort = HttpContext.Current.Request["sort"]})

解决方案使用HttpContext.Current.Request属性

在标题部分(其中设置了排序),我添加了以下内容:

<%: Html.ActionLink("linkText", "actionName", new { sort = "sortingName", page = HttpContext.Current.Request["page"] })%>
<%: Html.ActionLink(i.ToString(), "actionName", new { page = i, sort = HttpContext.Current.Request["sort"]})

在分页部分,我添加了以下内容:

<%: Html.ActionLink("linkText", "actionName", new { sort = "sortingName", page = HttpContext.Current.Request["page"] })%>
<%: Html.ActionLink(i.ToString(), "actionName", new { page = i, sort = HttpContext.Current.Request["sort"]})