我使用的MVC BeginForm代码如下,我无法获取控制器中输入控件的值。我在这里做错了吗?
using (Ajax.BeginForm("CreateApp", "App",
new AjaxOptions { UpdateTargetId = "my-modal-dialog", OnBegin = "Dialog.Closing()", OnSuccess = "Dialog.Close()" },
new
{
@class = "appform"
}
))
{
<input id="newAppName" type="text" size="35" value="" />
@Html.TextBoxFor(model => model.Application.AppName);
<input type="submit" value="Start App" class="demo-button ui-state-default ui-corner-all" />
}
My Controller looks like this
[HttpPost]
public ActionResult CreateApp(AppContent app, string newAppName)
{
}
答案 0 :(得分:2)
尝试更改
<input id="newAppName" type="text" size="35" value="" />
到
<input name="newAppName" type="text" size="35" value="" />