【发布时间】:2012-07-24 21:54:50
【问题描述】:
我正在使用 MVC C# 假设我有以下 ActionResult:
public ActionResult Create(string location)
{
...
View()
}
我需要在 [httppost] 中使用主要位置
[HttpPost]
public ActionResult Create(Employee employee)
{
...
// I need to access the value of location here but I dont' have access to the View
}
获得位置价值的最佳方式是什么。我可以创建一个视图模型并将该值传递给视图,然后在 [HttpPost] 中检索它,但我无法访问视图,因为它受到限制。
【问题讨论】:
-
我无法修改视图中的任何内容。视图已创建。我们被告知不要以任何形式修改它
-
@NatePet - 这是作业吗?听起来像是家庭作业通常需要的那种任意限制。
标签: asp.net-mvc-3