Link to home
Start Free TrialLog in
Avatar of Jaison Peter
Jaison Peter

asked on

ASP.net website error while expanding tree node

I have a bug in my simple ASP.Net web application. To reproduce this, you have to Download the below solution.

Code Download

There is a SQL server .bak file which you need to restore. The connection string in web.config is already pointing to this database "Kentico10" which you are going to restore from .bak file.

Once you run the application it loads the default page "TestPage.aspx".

There is a tree view on this page. Initially, the tree view is collapsed for the level one.

If you try to expand any of the nodes in level one, it will hit the code behind file testpage.aspx.cs , RemoveAndAddChildNode function .

I put a break point at the Line number 282

tn.ChildNodes.RemoveAt(nodeIndex);
This line will remove each child nodes of expanded node. and the next line will replace with a new node.

But the real issue is if we remove the child node using the above line. and if you try to expand any node, the node will never expand.it's being stuck there and not moves.

But try to comment the same line

"tn.ChildNodes.RemoveAt(nodeIndex); "
Expansion works.

But for replacing the nodes, first, i need to remove then I need to add.

So, please help me to expand the node without commenting line 282.
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

what version of SQL Server database are you using?

I can't find any instance when I try to restore it to my SQL Server 2008 R2.

User generated image
Avatar of Jaison Peter
Jaison Peter

ASKER

User generated image
its working in my sql server i restored it , "Kentico100"
I think at must take a step back and just explain what we're trying to accomplish... I don't see any you are removing nodes  and adding them again. What's the point? Why not just expand?
ASKER CERTIFIED SOLUTION
Avatar of Jaison Peter
Jaison Peter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i solved it myself