Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / July 2006

Tip: Looking for answers? Try searching our database.

HierarchicalDataSourceControl Class and System.StackOverflowExcept

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Francis Reed - 28 Feb 2006 19:31 GMT
Hi

When running the example code for the FileSystemDataSource which in found in
the HierarchicalDataSourceControl Class documentation, I get a
System.StackOverflowException. Can someone please help me solve this problem?

http://msdn2.microsoft.com/en-us/library/system.web.ui.hierarchicaldatasourcecon
trol.aspx


Thank in advance
Francis
DWS - 02 Mar 2006 15:27 GMT
Francis,
I've used that code as starting point for building a custom
hierarchiacaldatasourcecontrol.  Can you give the group a little more
information on the error, like which line of code generated the error maybe.

Thanks
DWS

> Hi
>
[quoted text clipped - 6 lines]
> Thank in advance
> Francis
Joey Chömpff - 03 Apr 2006 13:55 GMT
LS,

The following must make it but it isn't an elegant way.
I think there is an bug in designer.

FileSystemDataSourceView fsdsv = new FileSystemDataSourceView();
TreeView1.DataSource = fsdsv.Select();
TreeView1.DataBind();

Greetz,

Joey Chömpff
Francis Reed - 03 Apr 2006 14:29 GMT
Hi

Yes, I tried that too, and it did work. As you said, the other way of
dropping the controls in the designer doesn't work. I hope they fix it soon.

Cheers
Francis

> LS,
>
[quoted text clipped - 8 lines]
>
> Joey Chömpff
Joey Chömpff - 03 Apr 2006 14:42 GMT
That's strange and you have implemented it in the pageload?
spiralis - 18 Jul 2006 23:22 GMT
I too had the same problems as you describe, and I noticed that
wasn't alone... No help to find online. I solved it, and after doin
so I sent the following email to:'DevDocs@microsoft.com'

> (subject: Documentation Feedback:HierarchicalDataSourceContro
Class

> You seem to have an error in your documentation for the example o
the HierarchicalDataSourceControl class

> In the bottom part of the example you state
> "The following code example demonstrates how to declaratively bind
TreeView control to file system data using the FileSystemDataSourc
example.

> And then you erroneously repeat a previously defined class (Publi
Class FileSystemDataSource) instead of showing the declarative synta
and binding

> Note: I had huge problems with getting your example working becaus
of this. I made a search on the internet, and it seems I am not th
only one to have problems. The reason for this is that since th
declarative sample is missing, people set it up themselves. And th
easiest declarative setup is to do as follows

> <csp:FileSystemDataSource runat="server
id="ds" /
> <asp:TreeView runat="server
id="CatSelector" DataSourceID="ds" /

> But, this fails miserably! The first level data gets repeated fo
each folder node, or sometimes worse you get a stack overflo
(depending on the amount of files and folders in the app-root). Btw
if you use a Menu instead of a TreeView it works. And that wa
actually the hint needed to nail this one. I was finally able t
narrow it down to the PopulateNodesFromClient property for th
treeview. PopulateNodesFromClient is true by default, which mean
that the Select will ask for each folder separately (dynamically)
Since the example doesn't use the viewPath for it's select, it alway
starts from the root. Given your example the solution is to explicitl
set PopulateNodesFromClient to false in the declaration, like this

> [code:1:1aa4889fea
> <csp:FileSystemSetDataSource runat="server
id="ds" /
> <asp:TreeView runat="server
id="CatSelector" DataSourceID="ds
PopulateNodesFromClient="false" /
> [/code:1:1aa4889fea
>
> BTW: It would be nice if you included an example of how to us
viewPath in combination with the select as well. Then it would b
easier to make hierarchical data-sources that allowed for dynamicall
adding nodes (which is after all the default for the TreeVie
control)

This email should explain all you need to get this working

Regards
Ronn

---------------------------------
http://community.ihostasp.ne
ASP.NET Developer Community

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.