Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > HierarchicalDataSourceControl Class (FileSystemDataSource example)

Reply
Thread Tools

HierarchicalDataSourceControl Class (FileSystemDataSource example)

 
 
=?Utf-8?B?RnJhbmNpcyBSZWVk?=
Guest
Posts: n/a
 
      02-28-2006
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?RnJhbmNpcyBSZWVk?=
Guest
Posts: n/a
 
      02-28-2006
I apologize for the types. The following line in step 2 reads as follows

If I Press F5 (or Start Debugging), there are now errors on the screen.

replaced it with

If I Press F5 (or Start Debugging), there are no errors on the screen.



"Francis Reed" wrote:

> 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

 
Reply With Quote
 
 
 
 
Fixme
Guest
Posts: n/a
 
      06-01-2006

I've had the same experience. I have also written my own hierarchical
data source following the example, with similar results.

I'm pretty confident the example is erraneous. What happens is the data
bound control (the treeview) makes repeated calls to
GetHierarchicalView, with different values for the viewPath parameter
(the descendants of the root node). Since the sample returns the same
view every time, the calls seems never to get past the first child,
restarting every time, as it were.

Or so I thought. But having changed the code to create and return a new
view every time, the same error occurs. So I haven't gotten to the
bottom of it yet.

Good luck.



--
Fixme
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HierarchicalDataSourceControl Class and System.StackOverflowExcept Francis Reed ASP .Net Building Controls 4 04-03-2006 01:42 PM
TreeView with custom HierarchicalDataSourceControl Eamon Millman ASP .Net 2 02-18-2006 11:40 AM
TreeView with custom HierarchicalDataSourceControl Eamon Millman ASP .Net Building Controls 2 02-18-2006 11:40 AM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
A parameterized class (i.e. template class / class template) is not a class? christopher diggins C++ 16 05-04-2005 12:26 AM



Advertisments