Home - Forums-.NET - FlyTreeView (ASP.NET) - Client Side Confirm Before Drag & Drop Postback Event

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

Client Side Confirm Before Drag & Drop Postback Event
Link Posted: 03-Oct-2006 11:06
First off - what a great control. MUCH easier to use than others I have tried.

My question - I have my serverside NodeMoved and NodeInserted events firing correctly when nodes are dropped. I can also add a clientside Javascript confirmation by using OnDropJavascript=\"myFunc\".

What I can't do is get them both working together. ie. if I use

OnDropJavascript=\"return confirm('Sure?');\"

or even just use return true; inside a Jscript function, the server side event does not fire (in fact the postback doesn't even happen. I have also tried to explicitly force the postback, which works, but I can't get it to trigger the required event - protected void FlyTreeView1_NodeMoved(object sender, FlyTreeNodeMovedEventArgs e)

Any pointers much appreciated.

Thanks.
Link Posted: 04-Oct-2006 12:19
Set the  PostBackOnDropAccept=\"true\" this will help. This is required to automatically postback the page (even if returning true from handler).

This is current behavior of 4.0 version. We're changing it in 4.1: the page will postback if the user returns true from handler.
Link Posted: 04-Oct-2006 21:13
[quote="EvgenyT"]Set the  PostBackOnDropAccept="true" this will help.


Evgeny, this was already set. As I mentioned, the postback on its own works great, as does the Javascript. It's only when I combine the two (requesting a Javascript confirm before the postback) that the postback does not happen. I've just tested this further and found that the problem exists if any kind of alert box is used in the javascript ondrop code - same thing happens for a confirmation or an alert box. This means I can use the javascript to warn a user that the drag event was cancelled (for example because a node with the same value already exists in the target location - hence the postback is not needed anyway) but I cannot use it to prompt the user to confirm that moving or copying the node was desired (and I DO need to do this because most users are stupid...). I have tested the above problem on 3 different browsers (on 2 different clients running XP Pro) - IE7, IE6 and Firefox (Mozilla 5).

One other issue I've discovered is that if I drag and drop a node and then click on another node before the postback has occured (my back end database is at a datacenter many miles away so this will always be a possibility) then an exception occurs. I believe this is in your code rather than mine (and there have been plenty in mine!). Trace follows:

[NullReferenceException: Object reference not set to an instance of an object.] NineRays.WebControls.FlyTreeView.ApplyStateLog(String stateLog) +1737 NineRays.WebControls.FlyTreeView.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +61 System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +897 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2547

Many thanks (even more if you can fix the issues!). Once again, I've been using this control for only 2 days and my feedback is very positive (even taking the above issues into account). Documentation could be much better (especially client side), but I'm the worlds worst documenter myself!.
Link Posted: 06-Oct-2006 00:52
For the first issue. It is fixed (see the latest version from our site).

The second issue. Yes, it is a bug probably. I've just tried to emulate a postback delay, and have not got any error.
I'll try some other test further. And post here my results.
Link Posted: 06-Oct-2006 02:21
[quote="EvgenyT"]For the first issue. It is fixed (see the latest version from our site).
- Yes, that part now works perfectly - thank you for being so responsive.

I can reproduce the second issue at will. Unfortunately I can't provide access to the application for you, but if there is any other data I can provide then please let me know.

Thanks again.
Link Posted: 09-Oct-2006 13:09
I've not managed to reproduce the error.

If possible, could you please specify what actions and on what nodes do you take. Ideally it would be great if you can record a kind of video file from your browser actions (with windows media encoder or other screen capturing software).
Link Posted: 16-Oct-2006 23:23
Sorry for delay, have been away for a week. Will create a video this week and email you it (or a link to it).

Thanks again.