Hello,
I'm unsure whether this is an actual bug, but I can't seem to clear the selected text in the RadDropDownTree when i use UncheckAllNodes or UnselectAllNodes from the server side.
I try to to set SelectedText and SelectedValue on the RadDropDownTree control to string.Empty but neither works.
The nodes are unchecked though, but the text showing the previous selection is still visible after i reload the page.
What should I do to also set the text to represent the selection done by UncheckAllNodes?
Kind regards,
Anders
<telerik:RadDropDownTree RenderMode="Lightweight" ID="RadDropDownTree3" runat="server" Width="300px" DefaultMessage="Please select"
DataFieldID="EmployeeID" DataFieldParentID="ReportsTo" DataTextField="LastName"
DataSourceID="SqlDataSource1">
</telerik:RadDropDownTree>
<asp:SqlDataSource runat="server" OnSelecting="SqlDataSource1_Selecting" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT * From Employees"></asp:SqlDataSource>
protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
Label1.Text += "<br /> Sql request at:" + DateTime.Now.ToLongTimeString();
}
Workaround 1; input[type=text]::-ms-clear { display: none; } Workaround 2: // https://www.telerik.com/support/kb/aspnet-ajax/details/how-to-create-a-javascript-array-of-all-particular-radcontrols-on-the-page function get_allRadDropDownTrees() { var allRadDropDownTrees = []; var allRadControls = $telerik.radControls; for (var i = 0; i < allRadControls.length; i++) { var element = allRadControls[i]; if (Telerik.Web.UI.RadDropDownTree && element instanceof Telerik.Web.UI.RadDropDownTree) { Array.add(allRadDropDownTrees, element); } } return allRadDropDownTrees; } function fixClearButton(sender, args) { tree = sender; if ($telerik.isIE) { var dropDownTrees = get_allRadDropDownTrees(); dropDownTrees.forEach(function (dropdowntree) { $telerik.$(dropdowntree.get_filterElement()).on('input', function (e, a) { if (!e.target.value) { dropdowntree.filterByText("") } }) }) } Sys.Application.remove_load(fixClearButton); } Sys.Application.add_load(fixClearButton); Workaround 3: var tree; function OnClientLoad(sender, args) { tree = sender; if ($telerik.isIE) { $telerik.$(sender.get_filterElement()).on('input', function (e, a) { if (!e.target.value) { tree.filterByText("") } }) } }
Reproduction: https://www.screencast.com/t/Y6HRTmGngkJ
In order to workaround this bug, you can handle the OnClientNodeClicking client-side event of the embeddedTree and cancel the propagation of the event if the node that is about to be selected is disabled: protected void Page_Load(object sender, EventArgs e) { Reporting.EmbeddedTree.OnClientNodeClicking = "OnClientNodeClicking"; } <script type="text/javascript"> function OnClientNodeClicking(sender, args) { var nodeToSelect = args.get_node(); if (!nodeToSelect.get_enabled()) args.set_cancel(true); } </script>
The DropDownTree pop-up is not positioned properly when the <form> is wrapped inside a relatively positioned element with fixed width. The issue can be reproduced with a similar configuration: <div style="width: 700px; position: relative; left:300px"> <form id="form1" runat="server"> <telerik:RadScriptManager runat="server"></telerik:RadScriptManager> <div class="position"> <telerik:RadDropDownTree runat="server" ID="ddt1" CssClass="dropDownTree"></telerik:RadDropDownTree> </div> </form> </div>
Validation is not working as expected in Dropdowntree. In the demo page http://demos.telerik.com/aspnet-ajax/dropdowntree/examples/validation/defaultcs.aspx, if any one node is checked, the validation message "You need to select a type or a category before submitting the page" is displayed. If multiple checkboxes are checked, the message is not displayed. I do not want the validation message displayed when check box is checked.
When I set the RadDropDownTree Enbaled as False, the Clear button still working and clear the Selected value.