I have an ComboBox defined in MVC Razor as follows:
@(Html.Infragistics().ComboFor(item => item.LocationID).Width("100%").Height("34px").ValueKey("ID").TextKey("Locationn").ItemTemplate("Branch Address: ${BranchAdd1}").CompactData(false).DataSourceUrl(Url.Action("ComboDataLocation")).Render())
where the DataSourceUrl returns a model that includes ID,Locationn, and BranchAdd1. When I try the template with BranchAdd1, I get nothing in the dropdown list except for the literal I defined in the template. When I try it with Locationn, I get Locationn values and the literal in the dropdown list. I understand that CompactData should be set to false when I want all the values in the model, but it doesn't seem to be working. What am I missing?
Hello,
I will be happy to assist you with your inquiry.
May I ask if you can provide me with a screenshot your JSON data as it is after it's serialize from your "ComboDataLocation" Web Service? Do you notice all three members being serialized? Also, can you provide me with the version of IgniteUI you scripts you are using?
I am looking forward to hearing from you.
I am using the latest version - 2014.2
I am using the MVC helper:
@(Html.Infragistics().ComboFor(item => item.RentalLocationID) .Width("100%") .Height("34px") .ValueKey("LocationID") .TextKey("Location") .ItemTemplate("Branch: ${BranchName}") .CompactData(false) .DataSourceUrl(Url.Action("location-combo-data")) .DataBind() .Render() )
With the data model:
using System;using System.Collections.Generic;using System.Linq;using System.Web;namespace Web.Models{ [Serializable] public class LocationComboList { public int LocationID { get; set; } public string Location { get; set; } public string BranchName { get; set; } }}
With this controller action:
[ComboDataSourceAction] [ActionName("location-combo-data")] public ActionResult ComboDataLocation() { commonRepository = new CommonRepository(); IEnumerable<LocationComboList> locationComboList = commonRepository.GetLocationsComboList(); return View(locationComboList); }
GetLocationsComboList is filling the model correctly, the problem appears to be returning the model to the view.