I'm trying to use the GRID control in the MVCContrib library with my controller. The paging control for their Grid seems to have a big limitation, it only outputs a URL as MyPage.aspx?page=2. So when I press NEXT PAGE on the control is spits out "MyPage.aspx?page=2"
我正在尝试使用我的控制器在MVCContrib库中使用GRID控件。他们的Grid的分页控件似乎有一个很大的限制,它只输出一个URL为MyPage.aspx?page = 2。因此,当我按下控件上的NEXT PAGE时会吐出“MyPage.aspx?page = 2”
My control looks like this:
我的控件看起来像这样:
public ActionResult Index(int? page)
{
And my routing table looks like this:
我的路由表看起来像这样:
routes.MapRoute("admin", "admin/{page}", new { controller = "Admin", action = "Index", page = 1 });
For some reason my controller is not collecting the page querystring correctly. It just always appears as 1. If I send a URL such as admin/2 it works...but not when sent as admin?page=2.
由于某种原因,我的控制器没有正确收集页面查询字符串。它总是显示为1.如果我发送一个像admin / 2这样的URL它可以工作......但是当它作为管理员发送时没有?页面= 2。
What am I doing wrong?
我究竟做错了什么?
1 个解决方案
#1
I think you can find your answer here: ASP.NET MVC QueryString defaults overriding supplied values?
我想你可以在这里找到你的答案:ASP.NET MVC QueryString默认覆盖提供的值?
Hope this helps
希望这可以帮助
#1
I think you can find your answer here: ASP.NET MVC QueryString defaults overriding supplied values?
我想你可以在这里找到你的答案:ASP.NET MVC QueryString默认覆盖提供的值?
Hope this helps
希望这可以帮助