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.
I also tried this in your sample project and it did not work there either. I changed asp-mvc-helper to
@using (Html.BeginForm()) { <div class="sample-ui"> @Html.HiddenFor(item => item.OrderID) <div> <h4>Current Employee:</h4> @Html.DisplayFor(item => item.EmployeeName) </div> <div> <h4>Choose New Employee</h4> @(Html.Infragistics().ComboFor(item => item.EmployeeID) .Width("270px") .DataSourceUrl(Url.Action("employee-combo-data")) .ValueKey("ID") .TextKey("Name") .ItemTemplate("${Name} Title: ${Title}") .CompactData(false) .DataBind() .Render() ) </div> <input id="submitBtn" type="submit" value="Update" /> </div> }</body></html>
It shows the name and the tiitle literal but not the title.
Hi, Larry.
The problem with CompactData option is fixed. Now you can download the latest service release from here, and apply the fix. If you still have problems, please write us and we will try to resolve them.
Thank you for using our product.
Best regards,
Nikolay
Hello Larry,
Thank you for the update.
The CompactData option doesn't appear to be working as expected. For this reason, I have asked our Product Development team to examine this further. To ensure that it will receive attention, I have logged this behavior in our internal tracking system with a Development ID of 171369. The next step will be for a developer to review my investigation and confirm my findings or to offer a fix, or other resolution.
I will be sure to post the resolution onto this forum thread as soon as it is available.