ASP.NET MVC和寻呼 - 搜索和;结果场景
我在我的网页形式GET和后,我想我的获取表单上添加寻呼机..所以我在结果页面不能..
I have forms in my page a get and a post and i want add pager on my get form .. so i cant page through the results..
这是我遇到的问题是,当我移动到第二个页面不显示任何内容。
The problem that i am having is when i move to the second page it does not display anything..
我使用这个库分页..
http://stephenwalther.com/Blog/archive/2008/09/18/asp-net-mvc-tip-44-create-a-pager-html-helper.aspx
这我的行为code。
[AcceptVerbs("GET")]
public ActionResult SearchByAttraction()
{
return View();
}
[AcceptVerbs("POST")]
public ActionResult SearchByAttraction(int? id, FormCollection form)
{....
}
这是我用我的获取表单页面上通过什么
and this is what i am using on my get form to page through
<%= Html.Pager(ViewData.Model)%> //但是当我做到这一点去
这种方法
的[AcceptVerbs(GET)]
公众的ActionResult SearchByAttraction()
<%= Html.Pager(ViewData.Model)%> //but when i do this it goes to this method [AcceptVerbs("GET")] public ActionResult SearchByAttraction()
而不是去这本
的[AcceptVerbs(POST)]公众的ActionResult SearchByAttraction(INT?编号,形式的FormCollection)
[AcceptVerbs("POST")] public ActionResult SearchByAttraction(int? id, FormCollection form)
这样的使.. SENCE但我真的不能想到这样做的任何其他方式
which sort of makes sence .. but i cant really think of any other way of doing this
任何帮助将是非常美联社preciated ..
Any help would be very appreciated..
感谢名单
我建议反对通过HTTP POST做分页。网页和搜索条件是什么查询字符串都是为了完美2例。把查询字符串和放这些值;有一个负载你的行动ARGS。
I'd recommend against doing paging via HTTP POST. Page and search criteria are 2 perfect examples of what querystrings are meant for. Put those values in the query string & have that load up your action args.
想一想。您可以搜索谷歌的馅饼,导航到第14页,复制链接,并将其发送给你的奶奶。你不能这样做,当你的分页/只搜索与形式的岗位工作。
Think about this. You can search google for "pies", navigate to page 14, copy the link and send it to your grandma. You can't do that when your paging/search only works with form posts.