Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 22, 2013 03:58 AM by charakadr
Mar 16, 2012 04:25 PM|LINK
I am using VS2010 VB.net.
I am replacing a legacy vb6 web site with a .NET 4.0 web site, promising to provide users with the latest and greatest.
The old site has a dynamic handbuilt treeview window with <a> href links for nodes separated by <br> tags.
I used the .NET treeview control instead.
Now the users are complaining that the treeview has way too much vertical space between nodes and they have to scroll too much.
I tried changing the vertical padding, node spacing, and height properties for the nodes, but even when I set them to 0 the treeview got even bigger.
Am I outta luck? If so, I will revert to the primitive old handmade treeview so the users will shut up.
Mar 16, 2012 05:08 PM|LINK
Basically an Asp.net TreeView will be rentered as tables for each node inside div tag. Did you check you don't have any global styles which is overriding the default behaviour of table/div?
Mar 16, 2012 05:30 PM|LINK
That is not the case.
Are you able to reduce the vertical spacing between treenodes to be similar to the spacing create with a <br> tag? That's all I want.
The treeview control vertical spacing is about 50% larger than a <br> tag spacing.
Mar 16, 2012 06:00 PM|LINK
You can set whatever value you want with NodeStyle-NodeSpacing attribute of TreeView
<asp:TreeView ID="TreeView1" runat="server" NodeStyle-NodeSpacing="5px">
Mar 16, 2012 06:49 PM|LINK
I guess you overlooked the following statement in my original post:
"I tried changing the vertical padding, node spacing, and height properties for the nodes, but even when I set them to 0 the treeview got even bigger"
Mar 16, 2012 07:00 PM|LINK
Can you share your mark-up?
Mar 16, 2012 07:18 PM|LINK
This is pretty much out of the can.
<asp:TreeView ID="TreeView1" runat="server" ExpandDepth="0" NodeWrap="True"
ShowLines="True" Width="264px" Target="content" SelectedNodeStyle-ForeColor="#CC0000" ShowExpandCollapse="True"
I will reiterate - when I put a treeview on a screen WITHOUT CHANGING ANY SETTINGS it is too big - significantly bigger than just separating lines with a <br> or putting them in a table. Nothing I do makes it any smaller. Entering any
values, even 0px, for height, spacing, or padding, just makes it bigger. Do you see different behavior?
Oct 08, 2012 10:59 AM|LINK
I have made a post on this issue on my blog
i think this will help you :)
Jan 22, 2013 03:58 AM|LINK
From the design you can only reduce upto 5px. But you can do this by editing foundation.cs file.
check out my blog for more details.