I have a webpage that has a Telerik RadComboBox on the page. One of the properties of this ComboBox is EmptyMessage, which fills the combobox with a message when an item is not selected. I am binding my combobox to a datasource at runtime and for some reason, it wipes this EmptyMessage away. Is there a way to keep my data items in tact and have the empty message there too? And default it to the empty message?
Seems like the accepted answer on Telerik says that you use client side script to prevent the text editing.
<telerik:Radcombobox ID="RadComboBox1" runat="server" AllowCustomText="True" EmptyMessage="-please select one-">
<Items>
<telerik:RadComboBoxItem runat="server" Text="Item1"></telerik:RadComboBoxItem>
<telerik:RadComboBoxItem runat="server" Text="Item2"></telerik:RadComboBoxItem>
</Items>
<script type="text/javascript">
function pageLoad()
{
var combo = $find("<%= RadComboBox1.ClientID %>");
var input = combo.get_inputDomElement();
input.onkeydown = onKeyDownHandler;
}
function onKeyDownHandler(e)
{
if (!e)
e = window.event;
e.returnValue = false;
if (e.preventDefault)
{
e.preventDefault();
}
}
</script>