簡體   English   中英

帶iPad的MVC.NET 2

[英]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次才能有時工作..在我的筆記本電腦上,它永遠不會發生,一切都很好..

有人可以幫我嗎? 也許是瀏覽器和移動瀏覽器之間的區別?

鑒於它是隨機發生的並且不會發生在Chrome中(它在iPad上使用與Safari完全相同的渲染引擎),這顯然是競爭條件。

瀏覽器HTML中顯示的HTML是否有效 也許那里有問題?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM