<div class="form-combo" style="float: left"> @(Html.Kendo().ComboBoxFor(model => model.CardCode)//ComboBoxFor(model => model.CardCode) .Name("CardCode") .DataTextField("CustomerNameWithCode") .DataValueField("CustomerId") .Filter("contains") .HtmlAttributes(new {style = "width:250px;"}) .AutoBind(true) .MinLength(2) .Events(ev => { ev.Select("SelectCustomer"); ev.Change("ChangeCustomer"); ev.Close("CloseCombo"); } ) .DataSource(source => { source.Read(read => { read.Action("GetAllCustomers", "Order").Data("additionalDataCustomer"); }); source.ServerFiltering(true); }) ) <a style="cursor: pointer" onclick=" OpenCustomerPopUp() "><img src="~/Images/search.png" /></a> </div>
function SelectCustomer() { document.getElementById('divAddNew').style.display = "block"; //alert($('#CardCode').data('kendoComboBox').value()); comboValue = $('#CardCode').data('kendoComboBox').value(); } function ChangeCustomer() { comboValue = $('#CardCode').data('kendoComboBox').value(); SaveCustomerToSessionForSelect(); } function CloseCombo() { if ($('#CardCode').data('kendoComboBox').text() == 'No matching customers') { $('#CardCode').data('kendoComboBox').text(''); } } function additionalDataCustomer() { try { //alert($('#CardCode').data('kendoComboBox').input.val()); var str = $('#CardCode').data('kendoComboBox').input.val();//"Hello World!"; var n = str.length; //alert(n); if (str.length >= 2) { return { searchValue: $('#CardCode').data('kendoComboBox').input.val() }; } return { searchValue: "" }; } catch (e) { alert(e); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)