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


How to set empty message when AllowCustomTextis set to false in Radcombobox

Description



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 help 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">
//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

Author: Jayendra Kumar19 Feb 2010 Member Level: Gold   Points : 0

Thanks

Guest Author: planitron29 Jan 2013

Great thanks !
tag : telerik radcombobox allowcustom emptymessage

Guest Author: Santosh01 Feb 2013

Actually clicked on drop down value is not persists ,it take first value



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: