2016-10-03 11 views
9

Ben Web görünümü olarak bu kodu kullanıyorum, bu iyi çalışıyor, ancak Chrome geliştirici seçeneği ile ben Mobil Görünüm seçtiğinizde, formcollection kontrolörüformcollection Boş

GÖRÜNÜM boş dizeleri gösterir (Düzenleme updtaed)

<div class="page product-details-page deal-product-details-page"> 
    @using (Html.BeginForm("AddProductToCart_Details", "DealProduct", new { productId = Model.Id, shoppingCartTypeId = 1 }, FormMethod.Post)) 
    { 
     <div class="page-body"> 

      @using (Html.BeginRouteForm("Product", new { SeName = Model.SeName }, FormMethod.Post, new { id = "product-details-form" })) 
      { 
          @{ 
           var dataDictAttributes = new ViewDataDictionary(); 
           dataDictAttributes.TemplateInfo.HtmlFieldPrefix = string.Format("attributes_{0}", Model.Id); 
           @Html.Partial("~/Views/Product/_ProductAttributes.cshtml", Model.ProductAttributes, dataDictAttributes) 

          } 
          <!--gift card--> 
          @{ 
           var dataDictGiftCard = new ViewDataDictionary(); 
           dataDictGiftCard.TemplateInfo.HtmlFieldPrefix = string.Format("giftcard_{0}", Model.Id); 
           @Html.Partial("~/Views/Product/_GiftCardInfo.cshtml", Model.GiftCard, dataDictGiftCard) 

          } 
          <!--rental info--> 
          @{ 
           var dataDictRental = new ViewDataDictionary(); 
           dataDictRental.TemplateInfo.HtmlFieldPrefix = string.Format("rental_{0}", Model.Id); 
           @Html.Partial("~/Views/Product/_RentalInfo.cshtml", Model, dataDictRental) 

          } 
          <!--price & add to cart--> 
          @{ 
           var dataDictPrice = new ViewDataDictionary(); 
           dataDictPrice.TemplateInfo.HtmlFieldPrefix = string.Format("price_{0}", Model.Id); 
           @Html.Partial("~/Views/Product/_ProductPrice.cshtml", Model.ProductPrice, dataDictPrice) 


           @Html.Partial("~/Views/Product/_ProductTierPrices.cshtml", Model.TierPrices) 
          } 
          <!--wishlist, compare, email a friend--> 

            <!--attributes--> 
            @{ 
             var item = @Model.AssociateProductAttributesList.Where(x => x.Item1 == data.Id).Select(x => x.Item2).ToList()[0]; 
             bool isAttributes =false; 
            } 

            <div class="popup" data-popup="[email protected]"> 
             <div class="popup-inner"> 
              <h2>@data.Name</h2> 
              <p>@data.ShortDescription</p> 

              <br /> 
              @foreach (System.Collections.DictionaryEntry value in item) 
              { 
               var val = data.Id + "_" + value.Key.ToString(); 

               isAttributes = true; 
               @*<div class="attributes">*@ 
               <dl> 
                <dt id="product_attribute_label_19"> 
                 <label class="text-prompt"> 
                  @value.Key.ToString() 
                 </label> 
                </dt> 
                <dd id="product_attribute_input_19" class="[email protected]"> 
                 @Html.DropDownList("Attributes," + data.Id + "," + value.Key.ToString(), new SelectList((System.Collections.IEnumerable)value.Value, "Id", "Name"), "--- Please select ---") 

                </dd> 
               </dl> 
               @*</div>*@ 
              } 
              <br /> 
              <div onclick="ImageBlur('[email protected]')" class="buttons" style="text-align:left;"> 
               <input class="button-1" data-popup-close="[email protected]" type="button" value="Add to back" /> 
              </div> 

              <a class="popup-close" data-popup-close="[email protected]" href="#">x</a> 
             </div> 
            </div> 
            @if (item.Count == 0) 
            { 
             @Html.Hidden("Attributes," + data.Id + ",", "0") 
             <div class="popup" data-popup="[email protected]"> 
              <div class="popup-inner"> 
               <h2>@data.Name</h2> 
               <p>@data.ShortDescription</p> 


               <div onclick="ImageBlur('[email protected]')" class="buttons" style="text-align:left;"> 
                <input class="button-1" data-popup-close="[email protected]" type="button" value="Add to back" /> 
               </div> 


               <a class="popup-close" data-popup-close="[email protected]" href="#">x</a> 
              </div> 
             </div> 
            } 



           @if (isAttributes) 
           { 
            <a style="color: blue;" data-popup-open="[email protected]" href="#"> 
             <img id="[email protected]" src="~/Themes/Playground/Content/img/dealselectattribut.png" class="select-atr-img" style="width: 50%; margin-bottom: 10px;"/> 
            </a> 
           } 
          </div> 
         } 


        </div> 

        <div> 

        </div> 
        @{ 
         var dataDictAddToCart = new ViewDataDictionary(); 
         dataDictAddToCart.TemplateInfo.HtmlFieldPrefix = string.Format("addtocart_{0}", Model.Id); 
         <div class="overview" style="width:100%; margin-left:auto"> 

          @Html.Partial("~/Views/Product/_AddToCart.cshtml", Model.AddToCart, dataDictAddToCart) 

         </div> 
        } 


       </div> 
         } 

     </div> 
         } 
</div> 

Kontrol

public ActionResult AddProductToCart_Details(int productId, int shoppingCartTypeId, FormCollection form) 
     { 

      if (_productService.IsDealProducts(productId)) 
      { 
       if (!IsCompleteSelected(form)) 
       { 
        return Json(new 
        { 
         success = false, 
         message = " Plese select all associated product attribute " 
        }); 
       } 
      } 
//more code here 
} 

Normal Görünüm (Web Görünümü) enter image description here

Mobil Görünüm şeklinde

enter image description here

+0

Sorunu çoğaltmak için yeterli bilgi yok. Minik görünümler ve kontrolörler ile yeni bir proje oluşturabilir misiniz, böylece kopyalayabilelim mi? – Win

+0

Bu, böyle bir sorunu ilk kez duyuyorum. Tam formu HTML kodu –

+0

çok uzun gönderebilir miyim ... en aza indireyim – user6594294

cevap

3

Formu izin verilmez. Bu senin sorunun.

+0

ama eğer webview'de çalışıyorsa Sorun olarak, hatta web'de yanıt vermelidir – user6594294