Hi
I'm working on creating a hierarchical data source control to represent data
in an SQL database in a hierarchical way. To get started learning how to
create these controls, I decided to recreate to example on the
FileSystemDataSource.
Step 1
I created a class library called FileSystemDataSourceControl, and copy and
paste the code in the file called FileSystemDataSourceLib.cs in a namespace
called econcordia. Finally I build the Class library and produce
FileSystemDataSourceControl.dll
Step 2
I create a second project called mySite. While in design mode for
Default.aspx, I right click on the toolbar and select Choose Items... . I
then browse to the dll file I created previously. Now I can see
FileSystemDataSource under the general tab. I drag FileSystemDataSource to
the designer for Default.aspx. If I Press F5 (or Start Debugging), there are
now errors on the screen. I then drop an instance of the treeview in the
designer for default.aspx, and bind it to FileSystemDataSource1. Then when I
run it, I get the following error in FileSystemDataSourceLib.cs.
return (temp.GetFileSystemInfos().Length > 0);
An unhandled exception of type 'System.StackOverflowException' occurred in
mscorlib.dll
I have the feeling that the treeview is in and endless loop, constantly
calling the GetHierarchicalView method from the FileSystemDataSource class.
Also, if I delete the FileSystemDataSource from the designer in page
default.aspx, and instead put the following code in the Page_Load event for
page Default.aspx it works.
Econcordia.FileSystemDataSourceView v = new
Econcordia.FileSystemDataSourceView(".");
TreeView1.DataSource = v.Select();
TreeView1.DataBind();
So the previous code works, but I would like it, to be able to drag and
instance of the FileDataSource to the designer of page Defautl.aspx and get
it to work. Could someone help me get this example working? Here's a link to
the article. If someone can help me get this working I would really
appreciate it.
http://msdn2.microsoft.com/en-us/lib...cecontrol.aspx