This question is locked. New answers and comments are not allowed.
Hello everyone,
I have run into a problem with the MVC Grid and a collection that is part of my View Model.
I have a page (Razor, and a view model) and in my view model I have a list of address view models:
Address view model:
View Model for page:
AddressGrid partial:
My Question is: Why doesn't my Grid (in inline edit mode) show the "AddressGrid" partial that I created? I need to add multiple addresses per client. Any suggestion of how I can do it?
Thank you.
Tim
I have run into a problem with the MVC Grid and a collection that is part of my View Model.
I have a page (Razor, and a view model) and in my view model I have a list of address view models:
Address view model:
public class AddressVM{ [DisplayName("Address")] public string Address1 { get; set; } [DisplayName("Address cont")] public string Address2 { get; set; } [DisplayName("City")] public string City { get; set; } [DisplayName("State")] public string State { get; set; } [DisplayName("Zip Code")] public string ZipCode { get; set; } [DisplayName("Address Type")] public string AddressType { get; set; } public Guid ClientId { get; set; } public int AddressTypeId { get; set; } }View Model for page:
public class ClientVM{ [ReadOnly(true)] [ScaffoldColumn(false)] public Guid ID { get; set; } [DisplayName("First Name"), Required] public string FirstName { get; set; } [DisplayName("Last Name"), Required] public string LastName { get; set; } [UIHint("Date"),DisplayName("Date of Birth"), Required] public DateTime DateOfBirth { get; set; } [DisplayName("Tracking Number"), Required(ErrorMessage = "You must provide a client tracking number"), StringLength(15, ErrorMessage = "You must enter no more than 15 characters")] public string ClientTrackingNumber { get; set; } [DisplayName("Insurance ID Number"), StringLength(11, ErrorMessage = "You must enter no less than 10 characters or more than 11", MinimumLength = 10)] public string IDNumber { get; set; } [DisplayName("Phone Number (numbers only)")] public string HomePhone { get; set; } [DisplayName("Cell Phone Number (numbers only)")] public string CellPhone { get; set; } [DisplayName("Care Giver/Guardian")] public string CareGiver { get; set; } [DisplayName("Approved Units"), Required, DataType("Integer")] public int? ApprovedUnits { get; set; } [DisplayName("Available Units"), ReadOnly(true), UIHint("Label")] public int? AvailableUnits { get; set; } [DisplayName("Is this Client active?"), UIHint("TrueFalseDDL")] public bool IsActive { get; set; } [DisplayName("Addresses"), UIHint("AddressWindow")] public string AddressList { get; set; } [DisplayName("Diagnosis"), UIHint("DiagnosisSelectionBox")] public int DiagnosisCode { get; set; } [DisplayName("Selected Diagnoses List"), UIHint("DiagnosisList")] public string SelectedDiagnosisList { get; set; } [HiddenInput(DisplayValue = false)] public string DiagnosisListHidden { get; set; } public List<int> DiagnosisCodes { get; set; } [DisplayName("Providers"), UIHint("ProviderWindow")] public string Providers { get; set; } [ScaffoldColumn(false)] public Guid UserId { get; set; } [HiddenInput(DisplayValue = false)] public string ProvidersListHidden { get; set; } [UIHint("ProvidersList"), DisplayName("Selected Provider List")] public string SelectedProviderList { get; set; } public IQueryable<ProviderClientVM> ProvidersList { get; set; } public IQueryable<DiagnosisClientVM> DiagnosisList { get; set; } [UIHint("AddressGrid")] public List<AddressVM> AddressVM { get; set; } public List<UsersVM> Users { get; set; }}AddressGrid partial:
@model IEnumerable<AddressVM>@(Html.Telerik().Grid(Model) .Name("AddressGrid") .Columns(c => { columns.Bound(e => e.Address1).Width(25); columns.Bound(e => e.Address2).Width(25); columns.Bound(e => e.City).Width(25); columns.Bound(e => e.State).Width(25); columns.Bound(e => e.ZipCode).Width(25); columns.Bound(e => e.AddressType).Width(25); }))My Question is: Why doesn't my Grid (in inline edit mode) show the "AddressGrid" partial that I created? I need to add multiple addresses per client. Any suggestion of how I can do it?
Thank you.
Tim