Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 19th, 2011, 11:21 AM
Authorized User
 
Join Date: Jun 2011
Posts: 45
Thanks: 2
Thanked 0 Times in 0 Posts
Smile Chap 7 pg 257 TreeView ShowExpandCollapse problem

Imar, Can you tell me what I'm doing wrong? My TreeView works fine except the ShowExpandCollapse property always defaults to the Minus sign (-).

How can I have the ShowExpandCollapse property default to the plus sign (+)?

Thank You,
Jack Koyle
Michigan
 
Old December 19th, 2011, 01:09 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I am not sure what you mean. ShowExpandCollapse just determines whether you see the image in front of it or not; it does not define the image itself or its state.

If you want to collapse the tree by default, try something like:

myTreeView.Nodes[0].Collapse();

You can call it in the DataBound event of the TreeView.

If this doesn't help, please repost in a general ASP.NET category as it doesn't seem directly related to my book.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 19th, 2011, 01:54 PM
Authorized User
 
Join Date: Jun 2011
Posts: 45
Thanks: 2
Thanked 0 Times in 0 Posts
Smile Chap 7 pg 257 TreeView ShowExpandCollapse problem

I guess i didn't explain my issue well enough. Under the paragraph titlled 'Using the TreeView Control' on page 57 of Beginning ASP.NET 4 in C# and VB, the second sentence says, " Items can be expanded and collapsed with the small plus and minus icons in front of items that contain child elements.

In my situation, the plus and minus sign is always a minus sign. I can manually change the minus sign to a plus sign, but that code does not get stored anywhere. The next time I open up the DarkGrey theme, the icons are all expanded, showing the minus sign.

Here is the code from my Frontend Master file.
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" ShowExpandCollapse="True">

I hope you believe me that I am using your book. I am actually going through your book for the second time, cover to cover. It's a great book.

Thanks,
Jack Koyle
 
Old December 20th, 2011, 05:44 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
I hope you believe me that I am using your book.
Oh, no problem. That's not the point. But since the code in the book works as advertised, I thought you were maybe working on a different site / TreeView implementation.

Quote:
In my situation, the plus and minus sign is always a minus sign.
Where? In the browser? If so, I think that makes sense, as all nodes are expaned by default. When you click a minus sign, the node collapses and the icon changes into a plus, just like Windows Explorer does.

Quote:
I can manually change the minus sign to a plus sign, but that code does not get stored anywhere. The next time I open up the DarkGrey theme, the icons are all expanded, showing the minus sign.
Where? In Visual Studio? What do you change and what do you expect to get stored?

I am still not sure I fully understand the question so please elaborate when this is still an issue.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 21st, 2011, 12:07 PM
Authorized User
 
Join Date: Jun 2011
Posts: 45
Thanks: 2
Thanked 0 Times in 0 Posts
Smile Chap 7 pg 257 TreeView ShowExpandCollapse problem

I'm sorry you don't understand. I've said everything I can to describe the issue.

If you use Windows Explorer in Windows XP (all versions) you might notice that a folder might have a plus (+) sign next to it. That means that there are more folders inside the folder/directory or underneath that folder/directory.

When you click on the plus (+) sign, I'm sure you understand what happens.

I would like my treeview in my Planet Wrox project to display that plus sign when the Home page is displayed.

My issue is that your Planet Wrox treeview always defaults to the fully expanded view, i.e., the minus (-) sign.

If this doesn't make any sense to you, then I suggest we close this issue and I will continue studying your excellent book.

Thanks,
 
Old December 21st, 2011, 12:19 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

That makes perfect sense to me, and the answer to this question is in my first answer of this thread. if you want the entire tree collapsed when you first render the page, you need to programmatically collapse the top node of the tree. This way, the node collapses, and the plus sign is displayed instead of the minus sign. Then only when you click the plus does the tree expand and changes the image in a minus.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 3, pg 88, #6 jkoyle BOOK: Beginning ASP.NET 4 : in C# and VB 4 December 5th, 2011 03:10 PM
Chap. 4, Pg 121-123 tompp BOOK: Beginning ASP.NET 4 : in C# and VB 6 August 26th, 2011 01:33 PM
Try it Now, Chap. 4, Pg 123 jefals BOOK: Beginning ASP.NET 4 : in C# and VB 8 May 9th, 2011 11:41 AM
BasePage (Chap 4 pg 98) NetWorld BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 1 November 25th, 2010 02:39 PM
Chap 15 pg 532 tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 10 April 2nd, 2010 03:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.