Welcome Guest Search | Active Topics | Sign In | Register

The callback on 'x' has failed because the server did not recognize this callback.. Options
aaronh
Posted: Thursday, September 25, 2008 11:34:48 AM
Rank: Newbie
Groups: Member

Joined: 9/25/2008
Posts: 8
Hi there,

In regards to the TreeView control, I successfully ran X:\Essential Objects\Net20\Samples\VB\Demos\TreeView\Features\Populate On Demand\demo.ascx. It "lazy loaded" all items on demand as expected while running within the context of the EO solution.

However, whenever I try to execute the same code within another web project, I receive the message as specified in the subject of this post.

I have literally copied and pasted the .ascx and .vb code from demo.ascx and demo.vb into their own respective files within another web project, and I get the client side script error.

I should also mention that I am using Visual Studio 2008.

Any thoughts?
eo_support
Posted: Thursday, September 25, 2008 11:45:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

This usually indicates a code error with dynamic loading. The topic has been discussed here in great detail:

http://essentialobjects.com/Forum/Default.aspx?g=posts&t=1179#5018

As a simple test, you can try the same in a blank page with a static TreeView (do not use a master page either). That should work and you can then set out to find out the difference.

Please let us know how it goes!

Thanks
aaronh
Posted: Thursday, September 25, 2008 12:18:00 PM
Rank: Newbie
Groups: Member

Joined: 9/25/2008
Posts: 8
Hmmm, I'm not sure how the provided link discusses my issue in great detail? Is that the correct link?

Here's what I did:

* created a new web project
* added Webform1.aspx to the project
* copied and pasted demo.ascx and demo.vb code into Webform1.aspx and Webform1.vb respectively
* changed the default directory in the TreeView1_ItemPopulate event handler to point to a path that I have created (which contains a few files for demo purposes)
* ran the project, which works fine. In fact, I walked through the TreeView1_ItemPopulate event handler code and witnessed each node created and added to the SubGroup.Nodes collection, as well as successful completion of the handler.

And then upon the client side update, a popup message with the error occurred. The callback on 'X' has failed because the server did not recognize this callback and processed it as a normal request. This can occur if there are multiple Callback/CallbackPanel controls ...

Any other thoughts? Thanks!
aaronh
Posted: Thursday, September 25, 2008 12:26:10 PM
Rank: Newbie
Groups: Member

Joined: 9/25/2008
Posts: 8
Nevermind, I re-read. The trick is to put the treeView in the CallBack panel.
eo_support
Posted: Thursday, September 25, 2008 12:29:20 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Cool. Thanks for the update!
nick mcculloch
Posted: Thursday, October 16, 2008 2:29:35 AM
Rank: Member
Groups: Member

Joined: 10/16/2008
Posts: 10
I have followed this and aded a callback panel onto the form and this "callback" error is now no longer a problem. BUT, I dont seem to be getting an event fired back to server-side when an Item is "moved" via drag and drop.

This is the asp web page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="tree.aspx.cs" Inherits="tree" %>
<%@ Register TagPrefix="eo" NameSpace="EO.Web" Assembly="EO.Web" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<eo:CallbackPanel ID="eoCallback" runat="server"></eo:CallbackPanel>
<eo:TreeView ID="eoTreeView" runat="server" AllowDragDrop="True"
ControlSkinID="MSDN"
onitempopulate="eoTreeView_ItemPopulate"
onitemmoved="eoTreeView_ItemMoved" >
<LookNodes>
<eo:TreeNode ItemID="_Default">
</eo:TreeNode>
</LookNodes>
<TopGroup AllowDrag="True" AllowDrop="True">
<Nodes>

</Nodes>
</TopGroup>
</eo:TreeView>

</div>
</form>
</body>
</html>


Any ideas?
Nick
eo_support
Posted: Thursday, October 16, 2008 2:39:40 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I don't think ItemMoved event fires on its own. You would need to put a button or something else in the page to submit the page. The TreeView remembers all moved items on the client side until the page is posted back, at which time it fires the ItemMoved event.

Thanks
nick mcculloch
Posted: Thursday, October 16, 2008 2:59:50 AM
Rank: Member
Groups: Member

Joined: 10/16/2008
Posts: 10
OK, done that and yes I get the event fired on submission. BUT, for me, this is a major failing of the control unless I am missing something here.

Say, for example, I am managing a company structure made up as follows:
Company
Group
Division
Division
Dept
Dept
SubDept
SubDept


I cant see any way of preventing the Drag and Drop of Division into a Division. Business rules dictate no sub division only departments.
How can I implement these rules "client-side"? I can see the user making potentially a lot of changes before pressing "save". If there are business rules how do I roll-back everything to before any changes were made. Basically, I want to validate for any edit/move as the user performs the action. Is this possible?
eo_support
Posted: Thursday, October 16, 2008 3:12:29 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I believe you can let the TreeView to posts back by itself by setting the TreeView's RaisesServerEvent to true. That way everytime you drop a node, the TreeView's will raises ItemClick server event. As a by product, ItemMoved event is also fired because the page has already been posted back to the server side. However that does not prevent the drag and drop from hapening, because by the time ItemMoved event is fired, the node has already, as the event name suggested, been "Moved".

Alternatively, you can enforce your business logics on client side by handling the TreeView's ClientSideOnDragXXX event:

http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.Handlers.treeview_dragdrop_handler.html

For example, the following code will not allow you to drop anything on "Division":

Code: JavaScript
function drop_handler(treeView, srcNode, destNode, newIndex)
{
    //Returning false to prevent the node being dropped
    if (destNode.getText() == "Division")
        return false;
}


Code: HTML/ASPX
<eo:TreeView ClientSideOnDragDrop="drop_handler" ...>
....
</eo:TreeView>


Hope this helps.

Thanks
nick mcculloch
Posted: Thursday, October 16, 2008 3:20:50 AM
Rank: Member
Groups: Member

Joined: 10/16/2008
Posts: 10
Yes, thats what I need! Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.