4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 27 Aug 2013, 07:19 AM
Hi Balaji,
Please try the following JavaScript to clear the selection and display the default message.
JavaScript:
Thanks,
Shinu.
Please try the following JavaScript to clear the selection and display the default message.
JavaScript:
<script type=
"text/javascript"
>
function
OnClientClicked(sender, args) {
var
dropdowntree1 = $find(
'<%=RadDropDownTree1.ClientID %>'
);
dropdowntree1.get_entries().clear();
}
</script>
Thanks,
Shinu.
0
Hi Balaji,,
You ca use the approach that Shinu provided or the Clear button that is specially designed for this purpose as fully explained here.
Regards,
Kate
Telerik
You ca use the approach that Shinu provided or the Clear button that is specially designed for this purpose as fully explained here.
Regards,
Kate
Telerik
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 the blog feed now.
0
Balaji
Top achievements
Rank 1
answered on 27 Aug 2013, 08:12 AM
Hi Kate, Shinu,
Thank you for the response.
Actually the requirement is to clear the selection from Code behind.
Ex: I have a dropdowntree with below structure and I dont have checkboxes and so the clear button as well.
Country (Level 1)
---State (Level 2)
-------City (Level 3)
I have mapped city for each employee. On employee selection I would like to load the tree with selected value. If there is no city mapped against a employee, I need to clear the selection and show the default message "Select City".
For each employee, I read the data from database and display it to the user. When there is a value, I can set it as selected value and its works perfect. But when there is no data (NULL value from database), I am unable to clear the selected value of the previous employee.
Hope I am clear with my query.
Thanks,
Balaji.
Thank you for the response.
Actually the requirement is to clear the selection from Code behind.
Ex: I have a dropdowntree with below structure and I dont have checkboxes and so the clear button as well.
Country (Level 1)
---State (Level 2)
-------City (Level 3)
I have mapped city for each employee. On employee selection I would like to load the tree with selected value. If there is no city mapped against a employee, I need to clear the selection and show the default message "Select City".
For each employee, I read the data from database and display it to the user. When there is a value, I can set it as selected value and its works perfect. But when there is no data (NULL value from database), I am unable to clear the selected value of the previous employee.
Hope I am clear with my query.
Thanks,
Balaji.
0
Hello Balaji,
If you are trying to clear the items on button click for example you can find the control, access its selected entries and clear them by using the code below:
C#
Regards,
Kate
Telerik
If you are trying to clear the items on button click for example you can find the control, access its selected entries and clear them by using the code below:
C#
RadDropDownTree1.Entries.Clear();
Regards,
Kate
Telerik
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 the blog feed now.