473,566 Members | 2,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Treeview - strange behavior on Server 2003

Hi,

I have the following problem. I have a project that uses the Treeview
control. The code supports drag-drop functionality for moving nodes between
different levels and for changing their order within a level. On Windows 2000
Server everything works fine. When I put it on the 2003 Server, everything
worked exactly the same except for changing the order of nodes within a level.

If this were an error in code, I'd expect it to not work in both cases. If
something were wrong with the placement of my /webctrl_client/1_0 folder, I'd
expect problems with other parts of Treeview functionality, which is not the
case. Does anybody know what is going on?
Mar 9 '06 #1
4 1254
DWS
Dovla,
Let group see code for drag and drop tree.

Thanks
DWS
"Dovla" wrote:
Hi,

I have the following problem. I have a project that uses the Treeview
control. The code supports drag-drop functionality for moving nodes between
different levels and for changing their order within a level. On Windows 2000
Server everything works fine. When I put it on the 2003 Server, everything
worked exactly the same except for changing the order of nodes within a level.

If this were an error in code, I'd expect it to not work in both cases. If
something were wrong with the placement of my /webctrl_client/1_0 folder, I'd
expect problems with other parts of Treeview functionality, which is not the
case. Does anybody know what is going on?

Mar 9 '06 #2
There are several functions. I'll post them in separate threads for brevity.
Here's the JavaScript function from the treeview.htc file:

function ml_ondrop()
{
//reset border
this.style.bord er = "";

var start_id = 0;
var end_id = 0;

if( ( window.event.ty pe == "drop" ) && (
window.event.da taTransfer.getD ata( "Text" ) ) )
{
start_id = window.event.da taTransfer.getD ata( "Text" );
window.event.da taTransfer.clea rData();

var end_node = this.parentElem ent.treenode;
if( end_node )
{
end_id = end_node.getAtt ribute( "NodeData" );
}

if( ( start_id > 0 ) && ( end_id != 0 ) )
{
if( start_id != end_id )
{
var s_action = "move";
var confirm_text = "Confirm the move.";
if( prop_shiftKeyPr essed )
{
s_action = "sort";
confirm_text = "Confirm to rearrange.";
}

if( confirm( confirm_text ) )
{
var s_action = "move";
if( prop_shiftKeyPr essed )
s_action = "sort";
window.document .location.href = window.document .location.pathn ame
+ "?editmode=true &action=" + s_action + "&source=" + start_id + "&target=" +
end_id;
}
}
}
else
{
alert( "An error occured!" );
}
}
}

"DWS" wrote:
Dovla,
Let group see code for drag and drop tree.

Thanks
DWS

Mar 10 '06 #3
The method reorderTreeItem s is called from this bit of code in page_load:

if( !Page.IsPostBac k )
{
resetTree.Attri butes["onclick"] = @"return confirm('Jeste li sigurni?');";
if( action == "move" )
moveTreeItems() ;

if( action == "sort" )
reorderTreeItem s();

getTreeItems();
}
void reorderTreeItem s()
{
CPTreeView menu = new CPTreeView();
if( menu.IsReOrderV alid( source, target ) )
{
try
{
menu.ReOrderIte ms( source, target );
Response.Redire ct( Request.Path + "?editmode=true ", true );
}
catch( Exception ex )
{
Trace.Warn( this.ToString() , ex.Message, ex );
infoLabel.Text = "An error occurred while changing the order of
pages.<br>" + ex.Message;
}
}
else
{
infoLabel.Text = "Incorrect parameters while changing the order of
pages. Please try again.";
}
}
Mar 10 '06 #4
Finally, ReOrderItems and orderSiblingsOn Sort:

public void ReOrderItems( int source, int target )
{
if( DSWork() )
{
try
{
orderSiblingsOn Sort( source, target );
saveItems();
}
catch( Exception ex ) { throw ex; }
}
}

void orderSiblingsOn Sort( int source, int target )
{
int parent = getParent( source );
int sourceOrder = (int) ( dsWork.Tables[0].Select( "[PageID] = " +
source.ToString () ) )[0]["Ordering"];
int targetOrder = (int) ( dsWork.Tables[0].Select( "[PageID] = " +
target.ToString () ) )[0]["Ordering"];

// choose a sibling
string condition = "";
if( ( source == parent ) || ( target == -1 ) )
condition = "[Parent] = PageID";
else
condition = "[Parent] <> [PageID] AND [Parent] = " + parent.ToString ();

DataRow[] siblings = dsWork.Tables[0].Select( condition, "[Ordering]
ASC");
// change the order
foreach( DataRow r in siblings )
{
if( ( Convert.ToInt32 ( r["Ordering"] ) > targetOrder ) && (
Convert.ToInt32 ( r["PageID"] ) != source ) )
r[ "Ordering" ] = Convert.ToInt32 ( r["Ordering"] ) + 1;
}

// set new order for source item
( dsWork.Tables[0].Select( "[PageID] = " + source.ToString () )
)[0]["Ordering"] = targetOrder+1;

DataRow[] siblings2 = dsWork.Tables[0].Select( condition, "[Ordering]
ASC");
for( int i = 0; i<siblings2.Len gth; i++ )
siblings2[i][ "Ordering" ] = i + 1;
}
Mar 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1108
by: Dan | last post by:
Hi, We are currently experiencing a pretty strange behavior with TreeView control that comes with IE webcontrols. Actually when used on OS other than XP, everything works fine but when it is use on XP, the line that links a child node to his parent is not drawing and after that happens, the whole web application seems to be "freezed". ...
0
436
by: hzgt9b | last post by:
Using visual studio .NET 2003, VB: I'm experiencing an issue with a TreeView object when it gets focus - the first root node in the tree always gets selected when the control gets focus - even if another node has been clicked on... Here's my scenario: In my application, I have a couple of trees fully expanded as it starts up. The user then...
6
20057
by: Brian Smith | last post by:
Is there a way to avoid the default action of TreeNode expansion/contraction caused by double click? I can add an event handler to pop up my properties dialog on double click, but it has the unintended side-effect of toggling the expansion of that subtree. Thanks in advance, Brian
6
1339
by: Chris Marsh | last post by:
I have setup a treeview on my XP desktop and it displays data yet on the Windows 2003 Server it will not display the treeview. Does anyone have a clue on how to make this function on 2003 Server? thanks
4
1863
by: solex | last post by:
Hello, I am in the process of converting a project from VB6 to DotNet and have noticed that some strange behavior with the TreeView Control (1) when setting the NodeFont property to Bold I cannot see the complete text. (2) when selecting a child node that has a different icon from its parent, it takes on the parents' icon.
0
3112
by: kvrdeveloper1 | last post by:
Hello all, I am populating my treeview with only 1 level of items. Upon opening my screen, I call the RefreshTreeview routine which populates the treeview just fine, and I am able to click on nodes in the treeview and populate the appropriate data accordingly. However, once I add a new record via this screen and call the same...
8
12742
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the form. I only want to allow single selection, so using checkboxes is out of the question. It works as is, but it makes the form very cumbersome if...
0
2279
by: drop | last post by:
Hi, I'm currently working with the Treeview control in ASP .Net 2.0. The tree is filled dynamically based on data contained in a MySQL Database. Here is the exact behavior I want : 1 - User clicks on a node to expand it. 2 - Add a child node to the node clicked by the user saying the tree is loading that part. So here, I also need to...
0
1474
by: Christof Nordiek | last post by:
Hi, Below is a simple program that demonstrates my poblem. i fill a treeview with nine nodes. Then the treeview is shown with a scrollbar. But I can't scroll to the last item. scrolling to the bottom the last item remains almost nvisable. What is the matter? using System; using System.Collections.Generic;
0
7666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.