I have a kendo combobox
#(Html.Kendo().ComboBox()
.Name("ddSystems")
.Filter("contains")
.Placeholder("-- Select --")
.BindTo((IEnumerable<SelectListItem>)ViewBag.systemList)
)
Onchange, a textbox is loaded in ajax. A submit button posts the textbox value and combobox value to the controller. When I get back to the view, I need ddSystems to be reset to empty. I used
$('#ddSystems').data('kendoComboBox').value(null)
and
$('#ddSystems').data('kendoComboBox').text('')
but it always retains the previously selected value. Since I use ajax, this will not display the textbox and I am stuck. Please help.
This will clear the combo box and disable it
Google is your best friend....
var combobox = $("#comboBox").data("kendoComboBox");
combobox.value();
combobox.enable(false);
Related
We need to update validation messages on button click, so we need to refresh the UI. What we do is to fire OnPropertyChanged with empty strings. This worked for me to update validation messages but some comboboxes start resetting their values on UI refresh. The combobox whose itemsource is set dynamically is resetting its value to null but it has value in model. If someone have any ideas then please help.
We are working with kendo ComboBox using angular js. We bind value to ComboBox using angularjs scope. On preview event, when we assign value on load time (fetched from database) to ComboBox, it takes time to display value on front side in ComboBox. As we marked on preview time, first it binds data to ComboBox and then display value. Is there any solution to display selected value/text on front side, whether the ComboBox get bound or not?
Yes you can do it by applying value in the modal and setting the text accordingly.
Like Your model is countryId and have text value as countryName and name of the combobox is countryComboBox then you can use it like below:
$scope.countryId = 1 (id of which you want to be displayed at first)
$scope.countryComboBox.value(1)
$scope.countryComboBox.text('INDIA')
it will initially set the text to INDIA.
I have a VB6 application that has been running for quite sometime. Currently I'm trying to update one of the form that has a combobox 2.0. Because the combobox is populated with hundreds of items - I'm trying to update it so that users are able to click on a look up button next to it, where another window opens up with all the items from the combobox. User will be able to search by keyword and/or select an item and double click on it and have it appear in the combobox. The issue I'm having is with trying to pass no value or "" when CANCEL is clicked. I'm able to pass the value if I in the properties window my STYLE Is set to COMBO rather than list. However, the issue I come across is that with COMBO the value (text) in the combobox sometimes is not aligned properly. Is there a way to pass a "" value to a combobox 2.0 without changing the style to COMBO?
If they hit cancel set the ListIndex of your combo to -1 rather than setting the text property. This is the value for no item being selected.
I have a Telerik autocomplete control on my mvc view. I want to show a message to user if the user selects/types a value which isn't from the list of values.
How can this be done?
You can use the OnChange event which will be triggered when you blur from the AutoComplete. Also you have the new value under the e.value field of the event argument object.
I am populating a combobox dropdown with node fields from an Xml document. I have that working. Now I have the text in the dropdown menu of the combobox. I want to be able to press a 'Go' button and use the selected text. What are the commands please?
Have a look at the SelectedText property of ComboBox. It will return a string containing the currently selected text (ie. the text of the currently selected item) of the combo box.
To handle this from a button press, add an OnClick event handler to the button, and in this event handler get the SelectedText and do what you need with it.
During events, cboMyCombo.SelectedText may be null because its value has been cleared: "For example, if you retrieve the SelectedText value in a button Click event handler, the value will be an empty string." read here.
You may just want to try using cboMyCombo.Text