This is a migrated thread and some comments may be shown as answers.

AllowCustomText

1 Answer 18 Views
MultiColumnComboBox
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 15 Apr 2019, 12:59 PM
How to we prevent someone from entering a value which is not in the dropdown?

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 18 Apr 2019, 08:36 AM
Hello Lee,

You can try clearing the value if the selected index is less that 0: 

<script>
    function OnChange(sender, args) {
        if (sender.get_selected() < 0) {
            sender.kendoWidget._clearValue();
        }
    }
</script>

<telerik:RadMultiColumnComboBox ID="MCCB1" ClientEvents-OnChange="OnChange" runat="server" DataTextField="Text" DataValueField="Value">
</telerik:RadMultiColumnComboBox>

protected void Page_Load(object sender, EventArgs e)
{
    MCCB1.DataSource = Enumerable.Range(1, 4).Select(x=> new { Text = "Item " + x, Value = x});
    MCCB1.DataBind();
}

Additionally, you can set HighlightFirst="true" for the MultiColumnComboBox to decrease the chance of custom text entered.

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
MultiColumnComboBox
Asked by
Lee
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or