C# 提交按钮在asp.net mvc中不起作用

C# 提交按钮在asp.net mvc中不起作用,c#,asp.net-mvc,razor,C#,Asp.net Mvc,Razor,我有一个视图模型、控制器和视图,如下所示 public class H2HViewModel { public DateTime EffectiveDate { get; set; } public byte TransferMethod { get; set; } public string ListOfSelectedBatchID { get; set; } } 控制器 [HttpPost] [ValidateAntiForgeryToken] publ

我有一个视图模型、控制器和视图,如下所示

 public class H2HViewModel
{
    public DateTime EffectiveDate { get; set; }
    public byte TransferMethod { get; set; }
    public string ListOfSelectedBatchID { get; set; }

}
控制器

 [HttpPost]
 [ValidateAntiForgeryToken]
 public ActionResult Create(H2HViewModel model)
 {
   var detailPayments = db.Payments.Where(x => x.Status == 2).ToList();
   foreach (Payment detail in detailPayments)
   {
       detail.PaymentStatus = 4; 
       detail.EffectiveDate = model.EffectiveDate;
       detail.TransferMethod = model.TransferMethod.ToString();
   }
   db.SaveChanges();
   return RedirectToAction("Dashboard", "User");
 }
看法

@model EPayment.Data.ViewModels.H2HViewModel
@使用(Html.BeginForm())
{
@Html.AntiForgeryToken()
@EditorFor(model=>model.EffectiveDate,新的{@class=“form control dtpicker”})
@RadioButton(model=>model.TransferMethod,“AB”,new{htmlAttributes=new{@class=“form-control”})AB
@RadioButton(model=>model.TransferMethod,“BC”,new{htmlAttributes=new{@class=“form-control”})BC
}
当我点击提交按钮时,什么都没有发生, 我在ActionResult上创建了一个断点来调试它,但也没有发生任何事情。
我提到了这个,并且已经做了,但是没有用,你知道吗?谢谢。

您没有指定在哪里发布该表单
Html.BeginForm
可以接受。您应该指定
ActionName
ControllerName

@using (Html.BeginForm("Create", "Controller", FormMethod.Post))

注意:“Controller”将是您的控制器的名称。

@chaeusangchen您可以发布其余的HTML吗?您的模型可能未正确反序列化。你得到了什么样的回复?嗨@maxshuty,我已经在上面的代码中更新了我的html。我没有收到任何响应您的post方法上没有
[ValidateAntiForgeryToken]
,并且您的post方法不会返回任何数据!很抱歉我错过了,我已经更新了@LazZiya上面的代码
@using (Html.BeginForm("Create", "Controller", FormMethod.Post))