Hi
I use a RadComboBox with checkboxes.
I really need to clear or customize it's text, but there is no property for it.
ChekedItemTexts propery has just two options and it has not an option such as none , ...
Below command is not work too:
RadComboox1.text = "";
How can I clear its text?
thanks.
I use a RadComboBox with checkboxes.
I really need to clear or customize it's text, but there is no property for it.
ChekedItemTexts propery has just two options and it has not an option such as none , ...
Below command is not work too:
RadComboox1.text = "";
How can I clear its text?
thanks.
11 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 19 Sep 2012, 11:11 AM
Hi Fatima,
I suppose you want to clear the RadCombobox text. Here is the sample code that I tried.
JS:
Thanks,
Princy.
I suppose you want to clear the RadCombobox text. Here is the sample code that I tried.
JS:
function
OnClientLoad(sender, args)
{
sender.set_text(
""
);
}
Thanks,
Princy.
0
Hello Fatima,
When you use RadComboBox CheckBoxes feature - the text of the control displays the texts of the checked items.
If you want to clear the text in the RadComboBox - the proper approach is to "uncheck" the checked items programmatically by setting the Checked property of each item to "false".
Regards,
Kalina
the Telerik team
When you use RadComboBox CheckBoxes feature - the text of the control displays the texts of the checked items.
If you want to clear the text in the RadComboBox - the proper approach is to "uncheck" the checked items programmatically by setting the Checked property of each item to "false".
foreach
(RadComboBoxItem item
in
RadComboBox1.CheckedItems)
{
item.Checked =
false
;
}
Regards,
Kalina
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
Fatima
Top achievements
Rank 1
answered on 21 Sep 2012, 06:36 PM
Hi Kalina
Thanks for your reply, but I want that CheckBoxes have mark (if user wants)
But I need to clear it's text, because I want display RadAjaxLodingPanel in it during it's post-back. I did it but the text of ComboBox is ugly and LoadingPanel is not appear correctly.
Thanks
Thanks for your reply, but I want that CheckBoxes have mark (if user wants)
But I need to clear it's text, because I want display RadAjaxLodingPanel in it during it's post-back. I did it but the text of ComboBox is ugly and LoadingPanel is not appear correctly.
Thanks
0
Hi Fatima,
I am afraid that the checked items texts are always displayed in RadComboBox input .
This is a behaviour by design - simply the RadComboBox shows which items are checked.
If you want to clear the text in the input - you should uncheck the checked items.
cleared automatically.
Regards,
Kalina
the Telerik team
I am afraid that the checked items texts are always displayed in RadComboBox input .
This is a behaviour by design - simply the RadComboBox shows which items are checked.
If you want to clear the text in the input - you should uncheck the checked items.
cleared automatically.
Regards,
Kalina
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
Fatima
Top achievements
Rank 1
answered on 29 Sep 2012, 06:44 AM
Hi Kalina
Kalin
Many thanks of you. Your solution was worked for me; I use it when I want to clear its text.
(but I must return its status to primary state after it)
Many thanks of you. Your solution was worked for me; I use it when I want to clear its text.
(but I must return its status to primary state after it)
foreach
(RadComboBoxItem item
in
RadComboBox1.CheckedItems)
{
item.Checked =
false
;
}
0
NEX
Top achievements
Rank 1
answered on 17 Jan 2014, 03:43 AM
I want the checked items to remain checked. I just want to build my own display text string to show instead of 2 checked etc.
How do I override your default checkeditems text function?
You should add an option to use the text property instead.
How do I override your default checkeditems text function?
You should add an option to use the text property instead.
0
Shinu
Top achievements
Rank 2
answered on 17 Jan 2014, 05:14 AM
Hi,
One approach is that you can customize the default CheckedItem string by using ItemsCheckedString property of RadComboBox as follows.
ASPX:
Another approach is that you can set the text for RadComboBox from ClientSide as follows.
ASPX:
JavaScript:
Thanks,
Shinu.
One approach is that you can customize the default CheckedItem string by using ItemsCheckedString property of RadComboBox as follows.
ASPX:
<
Localization
ItemsCheckedString
=
"Checked"
/>
Another approach is that you can set the text for RadComboBox from ClientSide as follows.
ASPX:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
DataTextField
=
"Name"
OnClientDropDownClosing
=
"OnClientDropDownClosing1"
CheckBoxes
=
"true"
>
</
telerik:RadComboBox
>
JavaScript:
<script type=
"text/javascript"
>
function
OnClientDropDownClosing1(sender, args) {
sender.set_text(
"Updated"
);
}
</script>
Thanks,
Shinu.
0
NEX
Top achievements
Rank 1
answered on 17 Jan 2014, 05:25 AM
Thanks! But how can I pass a string defined on the server-side to it. I want to create a string on page load to place in the text field.
0
Shinu
Top achievements
Rank 2
answered on 20 Jan 2014, 10:54 AM
Hi,
As a work around please try the following code snippet which works fine at my end.
ASPX:
C#:
JavaScript:
Thanks,
Shinu.
As a work around please try the following code snippet which works fine at my end.
ASPX:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
AutoPostBack
=
"true"
CheckBoxes
=
"true"
OnItemChecked
=
"RadComboBox1_ItemChecked"
>
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"Item1"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"Item2"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"Item3"
/>
</
Items
>
</
telerik:RadComboBox
>
C#:
string
test =
string
.Empty;
protected
void
Page_Load(
object
sender, EventArgs e)
{
//assign value to test variable
test =
"demo"
;
}
protected
void
RadComboBox1_ItemChecked(
object
sender, RadComboBoxItemEventArgs e)
{
//passing the value to client side
string
script =
"function f(){setValue('"
+test+
"'); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
;
ScriptManager.RegisterStartupScript(Page, Page.GetType(),
"key"
, script,
true
);
}
JavaScript:
<script type=
"text/javascript"
>
function
setValue(text) {
var
combo = $find(
"<%=RadComboBox1.ClientID %>"
);
combo.set_text(text);
}
</script>
Thanks,
Shinu.
0
Naveen
Top achievements
Rank 1
answered on 18 Dec 2015, 04:19 PM
Hi Shinu,
I tried the above code but i am getting setValue is undefined error.
Thanks,
Naveen.
0
Hi Naveen,
Could you elaborate on what exactly you want to achieve?
Regards,
Eyup
Telerik
Could you elaborate on what exactly you want to achieve?
Regards,
Eyup
Telerik
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 Feedback Portal
and vote to affect the priority of the items