我在mvc
HttpGet
和HttpPost
中创建了两个同名方法。我以post
方法发布了datea,该方法正在我的localhost
视觉工作室中使用。但是,当我在服务器上上传时,它不起作用。它向我显示200
ok status
响应消息,但型号列表为null
解决方案
[HttpGet]
public ActionResult Index()
{
list ml = new list();
ml.test = UserDataList;
ml.spfilterreport = enqList;
return View(ml);
}
[HttpPost]
public ActionResult Index(Data DD)
{
list ml = new list();
ml.test = UserDataList;
ml.spfilterreport = enqList;
return View(ml);
}
<form name="myForm" action="~/Home/Index" method="post" enctype="application/x-www-form-urlencoded">
<div class="row" style="padding: 20px;background: white;margin-top: 6px;">
<div class="col-md-3">
<p>From Date: <input type="text" id="FromDate" name="FromDate" required></p>
</div>
<div class="col-md-3">
<p>To Date: <input type="text" id="ToDate" name="ToDate" required></p>
</div>
<div class="col-md-3">
<p><input type="submit" id="btnFilter" name="btnFilter" value="Filter" class="btn btn-info btn-lg" /></p>
</div>
</div>
</form>