MVC BeginForm没有数据发布

时间:2013-02-10 00:27:56

标签: c# jquery ajax asp.net-mvc asp.net-mvc-3

我使用的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)
    {

    }

1 个答案:

答案 0 :(得分:2)

尝试更改

<input id="newAppName" type="text" size="35" value="" />

<input name="newAppName" type="text" size="35" value="" />