【发布时间】:2014-04-04 21:25:07
【问题描述】:
剃刀代码:
@model Clarifi.API.DataContract.ManualScanItem
@using (Html.BeginForm(new { @class = "pull-left" }))
{
@Html.HiddenFor(m => m.ItemType)
@Html.HiddenFor(m => m.ItemIdentifier)
@Html.HiddenFor(m => m.Hotel.Address.AddressLine1)
@Html.HiddenFor(m => m.Hotel.Address.AddressLine2)
@Html.HiddenFor(m => m.Hotel.Address.CityCode)
@Html.HiddenFor(m => m.Hotel.Address.CityName)
@Html.HiddenFor(m => m.Hotel.Address.CompleteAddress)
@Html.HiddenFor(m => m.Hotel.Address.CountryCode)
@Html.HiddenFor(m => m.Hotel.Address.StateCode)
@Html.HiddenFor(m => m.Hotel.Address.StateName)
@Html.HiddenFor(m => m.Hotel.Address.ZipCode)
@Html.HiddenFor(m => m.Hotel.ClarifiId)
@Html.HiddenFor(m => m.Hotel.GeoCode.Latitude)
@Html.HiddenFor(m => m.Hotel.GeoCode.Longitude)
@Html.HiddenFor(m => m.Hotel.GeoCode.GeoCodeSource)
@Html.HiddenFor(m => m.Hotel.HasIssue)
@Html.HiddenFor(m => m.Hotel.Name)
@Html.HiddenFor(m => m.Hotel.PhoneNumber)
@Html.HiddenFor(m => m.Hotel.Rating)
@Html.HiddenFor(m => m.Hotel.SupplierFamily)
@Html.HiddenFor(m => m.Hotel.SupplierId)
<input type="submit" value="Verify" class="button-orange btn-action mtm btn-validate">
}
控制器中的操作:
public ActionResult MapGeoCode(ManualScanItem hotelModel)
{
ItemRs<ManualScanItem> response = manualScanProvider.GetNextScanItem(ManualScanItemType.GeoCodeScan);
if (!response.IsSuccess)
{
//this.SetErrorView(response);
return View("ErrorView");
}
return View(response.Item);
}
我什至检查了 http 请求。那里也有输入数据。但在我的控制器操作中,“hotelModel”为空。该怎么办?为什么会这样?
【问题讨论】:
-
方法上面有HttpGet和HttpPost注解吗? get方法的名字和MapGeoCode一样吗?
-
我尝试了放 [HttpPost] 和不放...但没有任何效果
标签: asp.net-mvc-4 razor asp.net-mvc-5