Is there any way to restrict the user from entering custom text into a databound multicolmncombobox. Forcing them to select an existing item. A dropdown list is not usable as it is bound to a table which has 5000 records. Some filtering based on a couple of fields is required.
Rumen
Telerik team
commented on 22 Feb 2023, 04:51 AM
Hi Chuck,
Have you tried by any chance to define a minimum filter length by using the MinLength property? For instance, if you set it to 3, the widget will not start filtering the dataset until at least 3 characters are entered.
Yes. That works properly to filter the results. The problem is when an item is eventually selected the user can add an additional character on the end and the text no longer matched an item from the list.
My combobox is also databound to a raddataform. If I try to insert or update the record it trys to insert the custom string into the database rather than the Item's ID . This throws an exception.
After further searching these forums (I cant seem to find the original post), I found code similar to the following which restricts their selection. sender.get_selected() returns -1 if if the text does not match an item on the list.
<script> function OnComboChange(sender, args) { if (sender.get_selected() < 0) { sender.kendoWidget._clearValue(); alert("Select an item from the list"); } } </script> Then add this to the RadMultiColumnComboBox you want to restrict. ClientEvents-OnChange="OnComboChange"
Hi Chuck,
Have you tried by any chance to define a minimum filter length by using the MinLength property? For instance, if you set it to 3, the widget will not start filtering the dataset until at least 3 characters are entered.
For example, check out this demo - https://demos.telerik.com/aspnet-ajax/multicolumncombobox/server-filtering/defaultcs.aspx.
Hi Rumen,
Yes. That works properly to filter the results. The problem is when an item is eventually selected the user can add an additional character on the end and the text no longer matched an item from the list.
My combobox is also databound to a raddataform. If I try to insert or update the record it trys to insert the custom string into the database rather than the Item's ID . This throws an exception.
After further searching these forums (I cant seem to find the original post), I found code similar to the following which restricts their selection. sender.get_selected() returns -1 if if the text does not match an item on the list.
<script>
function OnComboChange(sender, args) {
if (sender.get_selected() < 0) {
sender.kendoWidget._clearValue();
alert("Select an item from the list");
}
}
</script>
Then add this to the RadMultiColumnComboBox you want to restrict.
ClientEvents-OnChange="OnComboChange"
I cant seem to find the original post.