I have 2 comboboxes which Works perfect in a create form with a empty model
when I use the same 2 comboboxes in an update form only the first is populated
@(Html.Infragistics().ComboFor(m => m.omvisning.Bestiller_ID).ID("ddBestiller").TextKey("Navn").ValueKey("ID").Width("350px").NullText("Vælg bestiler").FilteringType(ComboFilteringType.Local).AutoComplete(true).DataSourceUrl("/Omvisning/Find_Bestiller").FilterExprUrlKey("filter").ValidatorOptions(o => o.Required(true)).DataBind().Render())
@(Html.Infragistics().ComboFor(m => m.omvisning.Kontakt_ID).ID("ddKontakt").TextKey("Person").ValueKey("ID").Width("350px").FilteringType(ComboFilteringType.Local).AutoComplete(true).DataSourceUrl("/Omvisning/Find_Kontakt").FilterExprUrlKey("filter").NullText("Vælg kontaktperson").CascadingSettings(settings => settings.ParentComboID("#ddBestiller").ParentComboKey("Firma_ID")).DataBind().Render())
I also have this JavaScript
$("#ddBestiller").igCombo({ selectionChanged: ddBestiller_Valgt });$("#ddKontakt").igCombo({ selectionChanged: ddKontakt_Valgt });
function ddBestiller_Valgt(evt, ui) {
if (ui.items != null) {
var id = ui.items[0].value;
var postData = { "ID": id };
$.getJSON("@Url.Content("~/Omvisning/Hent_Bestiller")", postData, function (data) {
if (data.OK == "JA")
{
$("#txtAdresse").text(data.Adresse);
$("#txtPostnr").text(data.Postnr);
$("#txtBynavn").text(data.Bynavn);
$("#txtLand").text(data.Land);
$("#txtEAN").text(data.EAN == null ? "" : data.EAN);
$("#txtSEnr").text(data.SENR == null ? "" : data.SENR);
$("#cbInstitution").prop("checked", data.Institution);
$("#cbSend_Email").prop("checked", data.Send_Email);
$("#cbForening").prop("checked", data.Forening);
$("#ddKontakt").igCombo("getData");
$("#ddKontakt").igCombo("selectedIndex", 0);
$("#ddKontakt").igCombo("activeIndex", 0);
var item = $("#ddKontakt").igCombo("itemByIndex", 0);
if (item.value != null) {
hent_kontakt(item.value);
}
});
return false;
};
function ddKontakt_Valgt(evt, ui) {
hent_kontakt(id);
function hent_kontakt(id)
$.getJSON("@Url.Content("~/Omvisning/Hent_Kontakt")", postData, function (data) {
$("#txtRefnr").text(data.refnr);
$("#txtEmail").text(data.Email);
$("#txtTlf_K").text(data.Tlf);
Hello Christian,
Is it possible for you to share a simple runnable code sample reproducing this issue, so I could further look into this matter for you? I believe I could be of further assistance, if I am able to debug this scenario.
You could attach a code sample to the private case CAS-140947-B4W1T0, if you prefer not to share such in the forum.
Why does it works when the model is empty
and not when there is data in the model
I use ComboFor
I have attached the datamodel
Thank you for your replies. However, in order to be able to research this scenario further I would need a full working sample demonstrating the issue in question. That would allow me to test the scenario with the model in question. Please provide us with a solution which can directly be used to examine this issue. Note that you could contact us with larger attachments directly through the support ticket for this matter - CAS-140947-B4W1T0.
Do not hesitate to contact me with any updates or questions.