How to set empty message when AllowCustomText is set to false in Radcombobox

Recently i faced problem in radcombox which is product of telerik. Telerik products are gaining popularity day by day .So i feel that if someone has this problem then it might be helping him.

Radcombobox has a property called AllowCustomText which means user can type something and result will be shown in dropdown .Radcombobox has also a property called EmptyMessage means when nothing is selected empty message will be shown.Example you set "select" as empty message then it will display when nothing is selected.

But problem is that i want to show this empty message but i want AllowCustomText to be false.Then if AllowCustomText is false then set empty message isn't working.I got a solution that is to make AllowCustomText as true and don't allow user to type something in combo.Here I am giving the code

Radcombobox:


<telerik:RadComboBox ID="RadComboBoxDispenseQ" runat="server" Height="170px" Width="100%"EnableLoadOnDemand="true" Style="margin: 0 auto 0 0px; display: block !important;EmptyMessage="Select Qualifier" AllowCustomText="true" ToolTip="Select Dispense" ExpandAnimation-Type="InCubic" Skin="Hay" ZIndex="10000000" LoadingMessage="LOADING" BackColor="#EDFBE1" DropDownWidth="200" >
</telerik:RadComboBox>

I set AllowCustomText="true" in the above combo
You need to add javascript code not to allow user to type.

<script type="text/javascript"&gt

//pageload add handler to that combo

  function pageLoad() {

            var combo = $find("<%= RadComboBoxDispenseQ.ClientID %>");
            var input = combo.get_inputDomElement();
            input.onkeydown = onKeyDownHandler;//handler added

           }

    //FOR DISABLE KEY PRESS of comboobox

    function onKeyDownHandler(e) {

        if (!e)

            e = window.event;

        e.returnValue = false;

        if (e.preventDefault) {

            e.preventDefault();

        }

    }

</script>
Thanks


Comments