C# “提交”按钮在asp.net mvc中不起作用
我有一个模型:C# “提交”按钮在asp.net mvc中不起作用,c#,asp.net-mvc,asp.net-mvc-4,razor,C#,Asp.net Mvc,Asp.net Mvc 4,Razor,我有一个模型: public class FormCreateModel { public FormModel formInfo { get; set; } public FieldModel fieldInfo { get; set; } public InstitutionModel selectedInst { get; set; } public FormTypeModel selectedFormType { get; set; } public
public class FormCreateModel
{
public FormModel formInfo { get; set; }
public FieldModel fieldInfo { get; set; }
public InstitutionModel selectedInst { get; set; }
public FormTypeModel selectedFormType { get; set; }
public CategoryModel categoryInfo { get; set; }
public List<InstitutionModel> institutions { get; set; }
public List<FormTypeModel> FormTypes { get; set; }
}
当我提交按钮时,newform仍为空。。我调试了它,发现submit按钮没有触发或向newform发送值。我只在MVC呆了几天,请帮助我改变
<input id="btnSubmit" type="button" value="Submit" />
到
对于输入元素类型
属性的可能重复项,应使用提交
而不是按钮
public ActionResult createNewForm(FormCreateModel newForm)
{
InstitutionManagement im = new InstitutionManagement();
newForm.institutions = im.getInstitution();
FormManagement fm = new FormManagement();
newForm.FormTypes = fm.getFormType();
return View("createNewForm", newForm);
}
<input id="btnSubmit" type="button" value="Submit" />
<input id="btnSubmit" type="submit" value="Submit" />