Reputation: 1444
I have a RadDropDownTree on my page as follows:
<telerik:RadDropDownTree ID="Tree1" runat="server" ButtonSettings-ShowClear="true"
OnClientEntryAdded="EntryAdded" AutoPostBack="true" DefaultMessage="--Select--"
DefaultValue="-1" OnEntryAdded="Tree1_EntryAdded">
<DropDownSettings AutoWidth="Enabled" CssClass="raddropdowntree" />
</telerik:RadDropDownTree>
The EntryAdded client side event is used to collapse the dropdown upon selection and is as follows:
function EntryAdded(sender, eventArgs) {
sender.closeDropDown();
return true;
}
The EntryAdded server side event is currently blank.
My problem is that the server side event EntryAdded is not fired if I specify the OnClientEntryAdded client side event. Postback happens upon selection of any item in the dropdowntree, Page_Load is fired, but then the control returns to the page without invoking the EntryAdded event. Another issue is that after postback, my selected value is cleared and it goes back to the default value of "--Select--".
I also tried replacing the declaration with OnClientEntryAdded="if(!EntryAdded()) { return false; }"
but this returns a JavaScript error, saying if
is unexpected.
If I remove the client side event, the EntryAdded server side event is invoked and the selected value of the dropdowntree is also retained.
The entire thing is in a RadAjaxPanel, if it helps.
Please advise. Thanks in advance.
Upvotes: 1
Views: 2022
Reputation: 1444
The following is a workaround that I found on the Telerik help forums.
function EntryAdded(sender, args) {
setTimeout(function () { sender.closeDropDown(); }, 200);
}
Upvotes: 1