
Karl Rohrbach
Top achievements
Rank 1
Karl Rohrbach
asked on 17 Aug 2010, 04:47 PM
I must be doing something wrong. I have a RadComboBox and it is showing the first item in the list bound to it vs. EmptyMessage. Any help would be appreciated. In the below example, I want the drop down to first display "Choose an Organization" Instead, it is displaying the DataTextField (first item in data set). Thanks in advance.
.ASCX Control
<
strong
>Organization:</
strong
><
br
/>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"OrganizationList"
EmptyMessage
=
"Choose an Organization"
EnableLoadOnDemand
=
"true"
HighlightTemplatedItems
=
"true"
Width
=
"600px"
BackColor
=
"#FFFFCC"
DataTextField
=
"Name"
DataValueField
=
"ContactId"
OnItemsRequested
=
"RadComboBox_LoadOrganizations"
>
<
ItemTemplate
>
<
table
style
=
"width: 550px;"
>
<
tr
>
<
td
><%# DataBinder.Eval(Container.DataItem, "Name") %></
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
.ASCX.CS Code Behind
protected void RadComboBox_LoadOrganizations(object sender, RadComboBoxItemsRequestedEventArgs e)
{
int userID;
userID = Convert.ToInt32(Server.HtmlEncode(Request.QueryString["UID"]));
OrgView.ContactLookup[] orglist = orgData.GetAssociatedContactsLookupList(userID);
OrganizationList.DataSource = orglist;
OrganizationList.DataBind();
}
9 Answers, 1 is accepted
0
Hello Karl Rohrbach,
Currently the empty message shows only if the RadComboBox is writable and in your case it is read-only. Luckily you can easily resolve this if you:
Best wishes,
Simon
the Telerik team
Currently the empty message shows only if the RadComboBox is writable and in your case it is read-only. Luckily you can easily resolve this if you:
- Set the AllowCustomText property to true.
- Handle the client-side Load event in this way:
function
onLoad(sender) {
var
input = sender.get_inputDomElement();
input.readOnly =
"readonly"
;
input.parentNode.parentNode.className =
"rcbReadOnly"
;
}
Best wishes,
Simon
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Ian
Top achievements
Rank 1
answered on 25 Aug 2010, 10:22 PM
Hello,
I am also experiencing the same issue where I want to display an EmptyMessage but instead the first item is being selected. when I run this I get an error that "Object doesn't support this property or method" which I suspect is coming from the .readOnly or attaching to the wrong Client-Side Load event.
Can you offer any advice with the code samples provided?
Thanks!
I am also experiencing the same issue where I want to display an EmptyMessage but instead the first item is being selected. when I run this I get an error that "Object doesn't support this property or method" which I suspect is coming from the .readOnly or attaching to the wrong Client-Side Load event.
Can you offer any advice with the code samples provided?
Thanks!
<
telerik:RadComboBox
ID
=
"cboAccountLists"
runat
=
"server"
Width
=
"300px"
AllowCustomText
=
"true"
EmptyMessage
=
"Select List"
HighlightTemplatedItems
=
"true"
DataValueField
=
"Value"
DataTextField
=
"Text"
>
<
ItemTemplate
>
<
asp:CheckBox
runat
=
"server"
ID
=
"chkDdAccountsLists"
Checked
=
"false"
onclick
=
"onAccountsListsCheckBoxClick(this)"
/>
<
asp:Label
runat
=
"server"
ID
=
"lblDdAccountLists"
AssociatedControlID
=
"chkDdAccountsLists"
Text='<%# Eval("Text") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
function
onLoad(sender) {
var
input = sender.get_inputDomElement();
input.readOnly =
"readonly"
;
input.parentNode.parentNode.className =
"rcbReadOnly"
;
}
0
Hi Ian,
You can attach the client-side Load event by setting the OnClientLoad property of the RadComboBox to the name of the handler function, e.g. OnClientLoad="onLoad".
I hope this helps.
Sincerely yours,
Simon
the Telerik team
You can attach the client-side Load event by setting the OnClientLoad property of the RadComboBox to the name of the handler function, e.g. OnClientLoad="onLoad".
I hope this helps.
Sincerely yours,
Simon
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

jojo
Top achievements
Rank 1
answered on 08 Aug 2012, 02:54 PM
I can implement your suggested solution, but when I do so, it appears to disable the entire combobox. Do you have a solution that allows us to set the text, not have it editable, but still actually use the combobox?
0
Hello Joanne,
What is the exact behavior you want to achieve?
The AllowCustomText property controls whether you can enter custom text or not.
Regards,
Helen
the Telerik team
What is the exact behavior you want to achieve?
The AllowCustomText property controls whether you can enter custom text or not.
Regards,
Helen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

jojo
Top achievements
Rank 1
answered on 08 Aug 2012, 03:32 PM
Thanks for your reply Helen, but I'm not sure what other information you require.
My requirement is the same as described in the previous posts:
I have a combobox with checkboxes in the template. I wish to be able to display some text in this box e.g. Please select...
However, I don't want:
- users to be able to type anything in here as it does not make any sense to do so.
- Most importantly I do not want it to display the text of just the first selected checkbox, as this could be misleading to users.
Does that help clarify the issue?
My requirement is the same as described in the previous posts:
I have a combobox with checkboxes in the template. I wish to be able to display some text in this box e.g. Please select...
However, I don't want:
- users to be able to type anything in here as it does not make any sense to do so.
- Most importantly I do not want it to display the text of just the first selected checkbox, as this could be misleading to users.
Does that help clarify the issue?
0
Hi Joanne,
The built-in CheckBox functionality provides the exact behavior that you need in your application. The following definition of RadComboBox shows the empty message and it does not allow typing in the input area:
I hope this will help.
Regards,
Ivana
the Telerik team
The built-in CheckBox functionality provides the exact behavior that you need in your application. The following definition of RadComboBox shows the empty message and it does not allow typing in the input area:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
CheckBoxes
=
"true"
EmptyMessage
=
"--Please make a selection--"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"item1"
/>
<
telerik:RadComboBoxItem
Text
=
"item2"
/>
<
telerik:RadComboBoxItem
Text
=
"item3"
/>
</
Items
>
</
telerik:RadComboBox
>
I hope this will help.
Regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

jojo
Top achievements
Rank 1
answered on 09 Aug 2012, 04:09 PM
This does not show textboxes or EmptyMessage in the version we are using (2010.2.826.35)
0
Hello Joanne,
The following should act just like the EmptyMessage property of the RadComboBox in the latest version:
Regards,
Ivana
the Telerik team
The following should act just like the EmptyMessage property of the RadComboBox in the latest version:
function
pageLoad() {
var
combo = $find(
"RadComboBox1"
);
combo.get_inputDomElement().value =
"-- please make a selection --"
;
}
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
>
<
ItemTemplate
>
<
input
type
=
"checkbox"
runat
=
"server"
/>
</
ItemTemplate
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"item1"
/>
<
telerik:RadComboBoxItem
Text
=
"item2"
/>
<
telerik:RadComboBoxItem
Text
=
"item3"
/>
</
Items
>
</
telerik:RadComboBox
>
Regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.