0

我有 2 个视图。视图 1 包含一个 html 表格,每一行都包含一个指向视图 2 的链接。

这是我的看法1

<tr>
    <td>
        <a href="@Url.Action("AssignStudent", "Session", new { slotId = item.TimeSlotId, roomId = item.RoomId, roomName = item.RoomName, starttime = dt })">Assign Session </a> 
    </td>
<tr/>

单击此它会在会话控制器中触发 assignstudent 方法

[HttpPost]
[AllowAnonymous]
public ActionResult AssignStudent(SessionDashboardViewModel dashboardModel)
{
    dashboardModel.SessionId = Convert.ToInt32(Request.Form["SessionId"]);
    dashboardModel.RoomId = Convert.ToInt32(Request.Form["hdnRoomId"]);
    dashboardModel.TimeSlotId= Convert.ToInt32(Request.Form["hdnSlotId"]);    
    SaveMethod(); //save working fine
    dashboardModel.SessionId = result;  
    ModelState.Clear();
    dashboardModel = InitViewData(dashboardModel);
    return View("SessionDashboard",dashboardModel);// call to source page
}

保存数据后问题就来了.

请帮忙。

谢谢

4

1 回答 1

0

而不是你的最后一行代码

return RedirectToAction("SessionDashboard", dashboardModel);
于 2012-09-24T15:11:32.793 回答