[英]MVC.NET 2 with iPad
我在使用平板电脑浏览我的网站时遇到问题(asp.net MVC 2和浏览器是移动版Safari或Android版)。 提交表单时,我的模型没有绑定,我收到了一些错误。 这只发生在平板电脑上(我试过iPad和ACER iconia标签A200)。
这是我的模型:
public class ChoixVehiculeImmatriculationModel : Model
{
[Required(ErrorMessageResourceName = "ImmatriculationRequise", ErrorMessageResourceType = typeof(Erreurs))]
public string Immatriculation { get; set; }
}
这是我的观点:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ChoixVehiculeImmatriculationModel>" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="immatriculation">
<% Html.BeginForm("ChoixImmatriculation", "ChoixVehicule", FormMethod.Post ); %>
<table id="tabImmatriculation">
<tr><td><%= Libelles.SaisissezNumeroImmatriculation %> :</td></tr>
<tr><td><%= Html.TextBoxFor(m => m.Immatriculation, new { maxlength = 20, autocomplete = "off" })%></td></tr>
<tr><td>
<div id="btnValider">
<div class="btnValidText" onclick="$(this).closest('form').submit();"><%= Libelles.Valider %></div>
</div>
</td></tr>
</table>
<%Html.EndForm(); %>
</div>
</asp:Content>
这是控制器:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ChoixImmatriculation(ChoixVehiculeImmatriculationModel model)
{
if ( ModelState.IsValid )
{
using ( IVehiculeUIService vehiculeService = GlobalContainer.Resolve<IVehiculeUIService>() )
{
List<VehiculeModel> vehicules = vehiculeService.GetListeVehiculesParImmatriculation(model.Immatriculation);
return GestionRetourSelonResultats(vehicules);
}
}
return View("ChoixVehiculeImmat", model);
}
ModelState.IsValid
为false,它表示Immatriculation
字段为null
。 但是文本框已经填满了!
它在开始时随机发生。 我必须做5次才能有时工作..在我的笔记本电脑上,它永远不会发生,一切都很好..
有人可以帮我吗? 也许是浏览器和移动浏览器之间的区别?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.