vendredi 15 juillet 2016

ASP.NET MVC, jQuery, modals and complex type list in viewmodel.

I have form in add.cshtml. I'am using razor and @Html.EditFor() helper.

My viewModel:

  public class MerchantViewModel {
  // properties
   public IEnumerable<AddBrandViewModel> Brands { get; set; }
  }

  public class AddBrandViewModel {

    public string Name { get; set; }
    public string Url { get; set; }
    public string Logo { get; set; }   
    public AddressViewModel Address { get; set; }

  }

And now in View I want to create AddMerchantViewModel and sens via ajax to my WebAPI.

I'am using .cshtml pages and @Html.EditFor helper. So Brands are collection of AddBrandViewModel.

I need display EditFor(brand => brand) // properties in MODAL. And after filled modal I want to add these data to UL in my form. How I can display EditFor(brand) in Modal.

Aucun commentaire:

Enregistrer un commentaire