我想单击Ajax按钮时检索数据库中的第一条记录,现在每当我点击我的按钮它返回我的记录列表时,我只想检索第一条记录,然后当我再次点击它时,返回第二个记录,甚至可能吗?
这是我的Ajax按钮:
@Ajax.ActionLink(" ", "BtnNext", null@*new { count = count + 1}*@, new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "current"
}, new { @class = "Middle-next dim btn btn-large-dim", @id = "Link1"})
这是Ajax按钮的控制器:
public PartialViewResult BtnNext()
{
var model = db.Queues.OrderBy(x => x.QueueNumber);
return PartialView("_queuenumber", model);
}
非常感谢你,新手<<
试试这个
var model = db.Queues.ToList().OrderBy(x => x.QueueNumber).Take(1);