I have a comboboxfor like the following:
@(Html.Infragistics().ComboFor(item => item.DocumentViewModel.Purpose) .AutoComplete(true) .FilteringType(ComboFilteringType.Local) .FilteringCondition(ComboFilteringCondition.StartsWith) .Width("100%") .Height("34px") .ValueKey("Purpose") .TextKey("Purpose") .DataSourceUrl(Url.Action("purpose-combo-data")) .DataBind() .Render() )
The key and value happens to be same, but I think the problem is that the model has a subclass, and the value passed from the model is not selecting in the combobox. The dropdown list is fine.
This combobox was working well in version 14.2, but I noticed this after upgrading to 15.2
Hello,
This issue is now resolved in the latest service release, build 15.2.20152.2081. This service release is available from your My Keys and Downloads Page on the Infragistics Website. To download the service release, select the 'Dev Tools' tab and then select the volume you are using. Finally, select the 'Service Releases' tab and the available service releases will be listed below. Please let me know if you have any questions or concerns about using this service release.
Upon further investigate with your sample project, it looks as though the combo is having trouble selecting when the is a string. If you change the aspnet-mvc-helper.cshtml to:
@using Infragistics.Web.Mvc@using IgniteUI.SamplesBrowser.Models@model IgniteUI.SamplesBrowser.Models.Northwind.Order<!DOCTYPE html><html><head> <title></title> <!-- Ignite UI Required Combined CSS Files --> <link href="@Url.Content("~/igniteui/css/themes/infragistics/infragistics.theme.css")" rel="stylesheet" /> <link href="@Url.Content("~/igniteui/css/structure/infragistics.css")" rel="stylesheet" /> <script src="@Url.Content("~/js/modernizr.min.js")"></script> <script src="@Url.Content("~/js/jquery.min.js")"></script> <script src="@Url.Content("~/js/jquery-ui.min.js")"></script> <!-- Ignite UI Required Combined JavaScript Files --> <script src="@Url.Content("~/igniteui/js/infragistics.core.js")"></script> <script src="@Url.Content("~/igniteui/js/infragistics.lob.js")"></script></head><body> <style> .sample-ui div { margin-bottom: 1em; } .sample-ui h4 { margin-bottom: .5em; } .sample-ui #submitBtn { width: 100px; } </style> @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.EmployeeName) .Width("270px") .DataSource(Url.Action("employee-combo-data")) .ValueKey("Name") .TextKey("Name") .DataBind() .Render() ) </div> <input id="submitBtn" type="submit" value="Update" /> </div> }</body></html>
where the key is now the name, you will see that the combo does not select it.
Thank for the information about the data. Using this I was able to reproduce this issue in an isolated sample. I have asked our engineering staff responsible for the igCombo 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 209806. 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 leave this case open and update you with any new information after the review. You can also continue to send updates to this case at any time.
You can view the status of the development issue connected to this case by selecting the "Development Issues" tab when viewing this case on the web site.
Please let me know if you need more information.
Here are my models:
public class EditDocumentViewModel { [Display(Name = "Is New")] public bool IsNewRecord { get; set; } [Display(Name = "File Required")] public bool FileRequired { get; set; } public DocumentViewModel DocumentViewModel { get; set; } }
and
public class DocumentViewModel { public string DocumentID { get; set; } [Display(Name = "File Name")] public string FileName { get; set; } [Display(Name = "Number")] public string DocumentNumber { get; set; } [Display(Name = "Description")] public string DocumentDescription { get; set; } [Display(Name = "Purpose")] public string Purpose { get; set; } [Display(Name = "Folder")] public string Folder { get; set; } [Display(Name = "Type")] public string FileType { get; set; } [Display(Name = "Document")] [RequiredIf("FileRequired", RequiredIfAttribute.CompareType.EqualTo, "True", "A file is required.")] public HttpPostedFileBase Document { get; set; } [Display(Name = "Created On")] public string CreatedOn { get; set; } [Display(Name = "Modified On")] public string ModifiedOn { get; set; } }
The string Purpose serves as the key and value. I am using the EditDocumentViewModel in my page with the DocumentViewModel defined as part of that object. I know that ASP doesn't translate dot notation directly when it forms the name in an input tag, instead it replaces the dot with an underscore, as in DocumentViewModel.Pupose to DocumentViewMode_Purpose if that helps.
Could you provide me with more details of how your Model is constructed. Could you give me an example of a data item that the combo would be bound to? From what I'm seeing here it looks like you expose a Purpose object in your model when then has a string based Purpose property. Having this information will aid me in reproducing the behavior on my end.