Hi Peter:
I have corrected the code, yet I still can’t get the combo box to select the item I want. My script is below. I would appreciate some help on this.
Thanks!
<script type=”text/javascript”>
$(document).ready(function () {
var data = @Html.Raw(Model.JSON_Str_Of_NonYTCBand); //Confirmed that the data is there. The combo box is loaded with the data.
var PreselectedValue = “@Model.List_Of_StdDemo_DataObj[0].NonYTCBand”
//alert(PreselectedValue); confirmed that the value is returned and that it is on th list.
$(“#jqx_NonYTCBand_Combo”).jqxComboBox({ source: data, displayMember: “displayName”, valueMember: “code”, width: 150, height: 25 });
$(“#jqx_NonYTCBand_Combo”).on(‘bindingComplete’, function (event) {
var item = $(“#jqx_NonYTCBand_Combo”).jqxComboBox(‘getItemByValue’, PreselectedValue);
$(“#jqx_NonYTCBand_Combo”).jqxComboBox(‘selectItem’, item ); //No error thrown, but the item is NOT selected.
});
});
</script>