【发布时间】:2011-01-16 20:50:47
【问题描述】:
伙计们。 我有一个正在编辑模型的 ASP.NET MVC 页面。 在执行每个动作时,我都有一个新控制器,所以我没有得到更新的模型。 我将模型实例保存到 Session["MyModelKey"] 中。但是每次执行操作时,即使我更改了这样创建的文本框中的值,我也有未修改的实例:
@Html.LabelFor(model => model.EMail) @Html.TextBoxFor(model => model.EMail) @Html.LabelFor(model => model.Country) @Html.TextBoxFor(model => model.Country) @Html.ActionLink("MyAction", "MyController")
控制器:
public class MyController : Controller
{
public ActionResult MyAction()
{
//Every time this action is executed - I have a new controller instance
//So I have null in View.Model
//I get Session["MyModelKey"] here,
//But the model instance properties are not updated
//even though I have updated E-mail and Country properties of the model in the UI
}
}
那么,我怎样才能获得更新的模型?
提前致谢。
【问题讨论】:
-
我不明白你的问题。
-
经过编辑,带来更多的问题。
标签: asp.net asp.net-mvc-3