473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1242
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.border = "";

var start_id = 0;
var end_id = 0;

if( ( window.event.type == "drop" ) && (
window.event.dataTransfer.getData( "Text" ) ) )
{
start_id = window.event.dataTransfer.getData( "Text" );
window.event.dataTransfer.clearData();

var end_node = this.parentElement.treenode;
if( end_node )
{
end_id = end_node.getAttribute( "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_shiftKeyPressed )
{
s_action = "sort";
confirm_text = "Confirm to rearrange.";
}

if( confirm( confirm_text ) )
{
var s_action = "move";
if( prop_shiftKeyPressed )
s_action = "sort";
window.document.location.href = window.document.location.pathname
+ "?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 reorderTreeItems is called from this bit of code in page_load:

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

if( action == "sort" )
reorderTreeItems();

getTreeItems();
}
void reorderTreeItems()
{
CPTreeView menu = new CPTreeView();
if( menu.IsReOrderValid( source, target ) )
{
try
{
menu.ReOrderItems( source, target );
Response.Redirect( 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 orderSiblingsOnSort:

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

void orderSiblingsOnSort( 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.Length; 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
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...
0
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...
6
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...
6
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?...
4
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...
0
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...
8
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...
0
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...
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...

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.