我正在开发MVC网站。我想逐个显示详细记录。用户单击“提交”按钮时显示的下一条记录。 请提供相同的建议 控制器中的代码
// GET: Member_Details
public ActionResult Member_Details(int sysmemberid , string type)
{
Member_Details obj = new Member_Details();
obj=obj.getMemberDetails(Convert.ToInt64(Session["Id"]), sysmemberid, type);// assign values to model
Session["sysmemberid"] = sysmemberid;
Session["type"] = type;
Session["Next"] = obj.next;
return View(obj);
}
[HttpPost]
public void Member_Details(Member_Details obj ,string command)
{
string sysmemberid = Session["sysmemberid"].ToString();
string type1 = Session["type"].ToString();
string sqlQuery = "";
int next = Convert.ToInt32(Session["Next"]);
RedirectToAction("Member_Details", new { sysmemberid = next, type = type1 });
}
查看代码:
@using (Html.BeginForm("Member_Details", "Member_Details", FormMethod.Post, new { id = "submitForm" }))
{
// Code to bind model
<button type="submit" id="btnSave" name="command" value="invite" class="btn btn-lg btn-primary btn-block link dtlSubmit">Connect</button>
}
答案 0 :(得分:0)
看起来你已经有了获得下一个项目并构建ReditectToAction
的逻辑,但它看起来并不像你要回来的那样。
将ActionResult
返回值添加到处理POST的Member_Details
:
public ActionResult Member_Details(Member_Details obj ,string command)
并返回RedirectToAction
:
return RedirectToAction("Member_Details", new { sysmemberid = next, type = type1 });