This is a migrated thread and some comments may be shown as answers.

OnEntryAdded not fired if OnClientEntryAdded specified

3 Answers 167 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Tauqir
Top achievements
Rank 1
Tauqir asked on 14 Aug 2013, 10:14 AM

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.


3 Answers, 1 is accepted

Sort by
1
Tauqir
Top achievements
Rank 1
answered on 15 Aug 2013, 07:48 AM

The following is a workaround that I found on the Telerik help forums.

function EntryAdded(sender, args) {
    setTimeout(function () { sender.closeDropDown(); }, 200);
}

0
Tarang
Top achievements
Rank 1
answered on 16 Aug 2013, 05:03 PM
No that does not seems to be working for me.. I've same situation.
0
Peter Filipov
Telerik team
answered on 21 Aug 2013, 08:12 AM
Hi Tarang,

Please try to increase the awaiting time to 500 and test again.

Regards,
Peter Filipov
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.
Tags
DropDownTree
Asked by
Tauqir
Top achievements
Rank 1
Answers by
Tauqir
Top achievements
Rank 1
Tarang
Top achievements
Rank 1
Peter Filipov
Telerik team
Share this question
or