日期:2014-05-17 浏览次数:20464 次
<p style="font-size: 20px; font: bold;">快速查找</p>
@using (Ajax.BeginForm("Search", new RouteValueDictionary { { "id", "" } }, new AjaxOptions { UpdateTargetId = "car", InsertionMode = InsertionMode.Replace }, new RouteValueDictionary { { "id", "searchForm" } }))
{
<span>用户名:</span><input type="text" name="title" id="title" style="width: 120px" />
<input type="submit" value="搜索(S)" accesskey="S" />
}
<div id="car">
@Html.Partial("_Search", ViewBag.Car_OwnersList as List<huoshan.Models.Car_Owners>)
</div>
@section Scripts
{
@{Html.RegisterMvcPagerScriptResource();}
<script type="text/javascript" src="/Scripts/jquery.unobtrusive-ajax.min.js"></script>}
<div>
<div style="float: left; width: 50%">共 @Model.TotalPageCount 页 @Model.TotalItemCount 条记录,当前为第 @Model.CurrentPageIndex 页</div>
@Ajax.Pager(Model, new PagerOptions { PageIndexParameterName = "id", ShowPageIndexBox = true, PageIndexBoxType = PageIndexBoxType.DropDownList, ShowGoButton = false }, new MvcAjaxOptions { UpdateTargetId = "car", HttpMethod = "Post", DataFormId = "searchForm" }, new { style = "float:right" })
</div>
public ActionResult SearCh(int id = 1)
{
List<Car_Owners> car = new List<Car_Owners>();
PagedList<Car_Owners> result = new PagedList<Car_Owners>(car, 0, 0);
ViewBag.Car_OwnersList = result;
if (Request.IsAjaxRequest())
return PartialView("_Search", ViewBag.Car_OwnersList);
return View(ViewBag.Car_OwnersList);
}
[HttpPost]
public ActionResult SearCh(string title, string author, int id = 1)
{
return ajaxSearchPostResult(title, author, id);
}
private ActionResult ajaxSearchPostResult(string title, string author, int id = 1)
&nb