kendo dropdownlist setting value on datasource - kendo-ui

im having the same problem as this one:
Setting default value of a dropDownList
i have dropdownlist on my grid but it does not save the selected value into the data source.
Unlike the textbox where i can do it using
container.find("input[name=Code]").val(d.Code).change();
this dont work on dropdownlists, and if i use .select(d.Code) it does select the value on dropdown but does not save it into datasource.
thanks in advance

Related

Kendo UI for MVC combobox autoclearing user entered text

I am working on a page that has a Telerik UI for MVC ComboBox. Currently the ComboBox does not keep user input once the datasource has returned any value from the database. Even if you reload the page, the ComboBox will remember the value from the Datasource and delete any user input once the focus is changed to another input field.
I need the ComboBox to keep user input if they do not select a value from the Datasource populated drop-down. Any help would be appreciated.
So I found the answer on the Kendo UI API reference. If you set the .SyncValueAndText(boolean) to false it will allow custom text to stay in the ComboBox. By default this value is set to true which binds the text and value together.
Here is a link to the API Documentation:
https://docs.telerik.com/kendo-ui/api/javascript/ui/combobox/configuration/syncvalueandtext

How to read datasource of a Kendo DropDownList only once?

(MVC Razor) So on my page I have a Kendo grid which contains a DropDownList within a certain column. Now I don't want to fill data of my dropdownlist from controller (With Viewbag/ViewData) before the page loads because it would slow it down, but instead I'd like to fill the DropDownList data on user click with a call to a controller function, and call the read method only once(on first click). How would I be able to achieve this goal?
Set autoBind property to false. It will cause that dropdown will not be filled by data before user click on it.
After component is initialized dataBound event is started so you can set readonly in it.
Demo here

kendo combobox delete value that is not in datasource after choosing value from datasource

I have a problem with the kendoUI combo box control –
The combo allows to type text which is not in the datasource.
But, if I put in text that is not in the list after choosing a item that is in the list – the value is deleted.
Can anyone help me out with the issue?

Manual input date in Kendo Grid DatePicker not working

I'm facing a problem that I can't understand. I'm using Kendo Grid with InCell edit and I have a DateTime field in my Model.
When the grid enters in edit mode, the calendar is shown, but the grid only saves the inputed value if I select the value from the calendar. If I input the field manually, the value is not saved and the cell is not marked has dirty.
If it helps, I'm using MVC with Razor sintax.
Tks in advance!
I've found a workaround in Kendo's forums:
By design, the DatePicker does not raise the change event when the value is set programmatically - it raises only if the date is modified by the end-user. In case you need to trigger the change event, you can use jQuery trigger().
For example:
var datePicker = $("#datepicker").data("kendoDatePicker");
datePicker.value("01/01/2001");
datePicker.trigger("change");
Reference:
http://www.kendoui.com/forums/ui/date-time-pickers/datepicker-change-event.aspx
So basically what I did was to force the change event manually.

AutocompleteExtender inside gridview

I am using an autocomplete extender inside a gridview. Inside the gridview, I have a country dropdown. When I select a country, the states should be populated in the autocomplete extender using textbox.
I am able to populate the countries and states. But when I have multiple rows in the gridview,
I select a country in row 1 of the gridview.
But all the StatesTextbox are updated with the states based on this selection. i.e, I am not able to choose which textbox/row should be updated on Dropdown selected event.
Could anyone help me on this issue? Appreciate your response!!
I fixed this by setting the context key of the autocompleteextender to the dropdownlist selected value and retrieved the value when I typein something in the statesearch textbox.

Resources