[英]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.