I have a combobox as this (information is retrieved in pages of 30 records).
@model AutomotoraWeb.Models.ConsultaVentaModel
@using System.Web.UI.WebControls
@Html.DevExpress().ComboBoxFor(model => model.Cliente.Codigo,
settings =>
{
settings.Name = "comboBox3";
settings.Width = 530;
//settings.SelectedIndex = 0;
settings.Properties.DropDownWidth = 550;
settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
settings.CallbackRouteValues = new { Controller = "ConsultasFin", Action = "ListClientesCuotas" };
settings.Properties.CallbackPageSize = 30;
//settings.Properties.TextField = "Nombre";
settings.Properties.ValueField = "Codigo";
//settings.Properties.ClearButton.Visibility = AutoBoolean.True;
settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
settings.Properties.ClientSideEvents.SelectedIndexChanged = "ComboClientesChanged";
//settings.Properties.ClientSideEvents.SelectedIndexChanged = "function(s, e) {alert(s.GetValue())}";
}
).BindList(ViewData["ClientesCuotas"]).GetHtml()
I want to set the selected value from javascript, when the user enters a code a press a button, the javascript captures the inputed code and then selects the corresponding value in the combobox.
The javascrips looks like this. The second line is the one that should be modified, I just include it to show the idea:
var selectedCli = $("#txCodigoCli").val();
comoBox3.selectedValue = selectedCli //if selectedCli is not in the current page, it should be retreived from the server to display the name corresponding to the code.
Thanks
Mariel