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?
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?
belgie
Member
40 Points
26 Posts
Treeview control - too much vertical space between nodes
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.
Thanks
Bill
Bimalvv
Contributor
2362 Points
481 Posts
Re: Treeview control - too much vertical space between nodes
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?
Bimal
belgie
Member
40 Points
26 Posts
Re: Treeview control - too much vertical space between nodes
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.
Bimalvv
Contributor
2362 Points
481 Posts
Re: Treeview control - too much vertical space between nodes
Mar 16, 2012 06:00 PM|LINK
You can set whatever value you want with NodeStyle-NodeSpacing attribute of TreeView
Bimal
belgie
Member
40 Points
26 Posts
Re: Treeview control - too much vertical space between nodes
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"
Bimalvv
Contributor
2362 Points
481 Posts
Re: Treeview control - too much vertical space between nodes
Mar 16, 2012 07:00 PM|LINK
Can you share your mark-up?
Bimal
belgie
Member
40 Points
26 Posts
Re: Treeview control - too much vertical space between nodes
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"
NodeIndent="10">
</asp:TreeView>
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?
charakadr
Member
10 Points
7 Posts
Re: Treeview control - too much vertical space between nodes
Oct 08, 2012 10:59 AM|LINK
I have made a post on this issue on my blog
http://problemsimet.blogspot.com/
http://problemsimet.wordpress.com/category/asp-net/
i think this will help you :)
charakadr
Member
10 Points
7 Posts
Re: Treeview control - too much vertical space between nodes
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.
problemsimet.blogspot.com
https://problemsimet.wordpress.com/