Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Learnig to Build a Tree View Control

Reply
Thread Tools

Learnig to Build a Tree View Control

 
 
dwok
Guest
Posts: n/a
 
      03-08-2005
Does anyone know of a good article that discusses creating a "Tree
View" control in ASP.NET? Or perhaps a Tree View Control that comes
with source code? I have come across a lot of tree controls for ASP.NET
however most of them are already compiled and don't come with source
code. I am really just looking for an example on how to create my own
Tree Control. Thanks a bunch.

 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      03-08-2005
Creating a Tree View Control is the same as creating or designing an
application. You enumerate a set of requirements, look at the available
tools and technologies, figure out what will satisfy your requirements, and
come up with a plan. Rather than looking at examples of how other people
soved the problem, why not look at this as an opportunity to practice your
analysis and design skills?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"dwok" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Does anyone know of a good article that discusses creating a "Tree
> View" control in ASP.NET? Or perhaps a Tree View Control that comes
> with source code? I have come across a lot of tree controls for ASP.NET
> however most of them are already compiled and don't come with source
> code. I am really just looking for an example on how to create my own
> Tree Control. Thanks a bunch.
>



 
Reply With Quote
 
 
 
 
recoil@community.nospam
Guest
Posts: n/a
 
      03-08-2005
It is extremely simple.
While I do not have the time to go into greater detail regarding how it
is the topics you should be familiar with already are
Using the Viewstate to store your own variables.
Creating custom classes that are serializable and deserialiazable
and Recursiveness

if i were you i would build a custom class that implements ICollection.
This will be referred to as your NodeCollection from here on out.
You will have another custom class. This will be referred to as your
Node from here on out.
Both have to be marked as Serializable. Look up this Attribute in the
msdn library.
For speed skae you should implement ISerializable and implement the
special constructor and add and retrieve all of your variables
manually. This requires more code but offers a significate performance
boost as it doesnot have to use reflection when serializaing and
deserializing.

Your TreeNode will have a property that is of the type NodeCollection.
you will override LoadViewState and SaveViewState and by simply adding
your Tree's Node Collection to the viewstate everything is serialized
automatically and deserialized. All you have to do is add and retrieve
it from the Viewstate.

Rendering is simply a matter of Recursive ness.
foreach (treenode in treenodecollection)
{
render node
callself(treenode.Nodes)
}



Hope this is helpful in any way

 
Reply With Quote
 
recoil@community.nospam
Guest
Posts: n/a
 
      03-08-2005
spoken like a true MVP

 
Reply With Quote
 
dwok
Guest
Posts: n/a
 
      03-08-2005
Did you intend for this to be helpful?

 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      03-08-2005
if you goto the book store and look at the javascript/html section, you
should find lots of material on this and other html ui components. in the
asp.net seciton you may even find .net implimentations.

if you go to any website that has a tree control you like, with the browser
view source to see the code. firefox has really good tools for this.

-- bruce (sqlwork.com)



"dwok" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
| Did you intend for this to be helpful?
|


 
Reply With Quote
 
Tim Stall
Guest
Posts: n/a
 
      03-08-2005
Hello Dwok,
Check out the control gallery at ww.asp.net:
It has an entire section dedicated to treeviews:
http://www.asp.net/ControlGallery/de...=28&tabindex=2

I personally have used this one with success (it's free):
http://www.asp.net/ControlGallery/Co...014&tabindex=2

Some tips to get you started:
1 - Think out your requirements. Do the nodes need to be multi-line? Should
they be able to contain any HTML (images, tables, etc...) or just single
literal strings or links.
2 - How will you set the data? With an xml file, from a DataTable (with
recursive columns), programatically?
3 - Figure out your javascript/html needs: (1) how to children collapsed
(hidden), (2) how to persist across postback. Look at the view-source for
other successful treeviews.


"dwok" wrote:

> Does anyone know of a good article that discusses creating a "Tree
> View" control in ASP.NET? Or perhaps a Tree View Control that comes
> with source code? I have come across a lot of tree controls for ASP.NET
> however most of them are already compiled and don't come with source
> code. I am really just looking for an example on how to create my own
> Tree Control. Thanks a bunch.
>
>

 
Reply With Quote
 
Sundararajan
Guest
Posts: n/a
 
      03-09-2005
Hi,

For building the treeview control u should decide on which data source u
r going to use to populate the tree view. i have developed a treeview control
in which the nodes and all the info. required for the elements in the tree
view control are in XML files. then using XML dom we can parse through that
and develop the tree view control.
for more info. regarding the tree view control u can look into the
june2004 edition of MSDN Magazine.

Regards,
Sundararajan.S

"Tim Stall" wrote:

> Hello Dwok,
> Check out the control gallery at ww.asp.net:
> It has an entire section dedicated to treeviews:
> http://www.asp.net/ControlGallery/de...=28&tabindex=2
>
> I personally have used this one with success (it's free):
> http://www.asp.net/ControlGallery/Co...014&tabindex=2
>
> Some tips to get you started:
> 1 - Think out your requirements. Do the nodes need to be multi-line? Should
> they be able to contain any HTML (images, tables, etc...) or just single
> literal strings or links.
> 2 - How will you set the data? With an xml file, from a DataTable (with
> recursive columns), programatically?
> 3 - Figure out your javascript/html needs: (1) how to children collapsed
> (hidden), (2) how to persist across postback. Look at the view-source for
> other successful treeviews.
>
>
> "dwok" wrote:
>
> > Does anyone know of a good article that discusses creating a "Tree
> > View" control in ASP.NET? Or perhaps a Tree View Control that comes
> > with source code? I have come across a lot of tree controls for ASP.NET
> > however most of them are already compiled and don't come with source
> > code. I am really just looking for an example on how to create my own
> > Tree Control. Thanks a bunch.
> >
> >

 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      03-09-2005
How do you think I came to become one?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"(E-Mail Removed)" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> spoken like a true MVP
>



 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      03-09-2005
If you're replying to me, the answer would be "yes, doubtless more helpful
than you realize."

Which is more helpful - to feed a man a fish, or to teach a man to fish?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"dwok" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Did you intend for this to be helpful?
>



 
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
abt tree view in asp.net can i hide the tree nodes ? raki ASP .Net 1 06-24-2009 11:45 AM
Learnig to Build a Tree View Control dwok ASP .Net 10 03-09-2005 04:12 PM
Learnig to Build a Tree View Control dwok ASP .Net Building Controls 10 03-09-2005 04:12 PM
SWsoft Acronis Disk Director Suite 9.0 Build 508, Acronis OS Selector 8.0 Build 917, Acronis Partition Expert 2003 Build 292, Acronis Power Utilities 2004 Build 502, F-SECURE.ANTI vIRUS.PROXY v1.10.17.WINALL, F-SECURE.ANTI vIRUS v5.50.10260 for CITRI vvcd Computer Support 0 09-25-2004 01:38 AM
B tree, B+ tree and B* tree Stub C Programming 3 11-12-2003 01:51 PM



Advertisments