views:

145

answers:

2
+1  Q: 

.net 2.0 ajax tree

Right, so I have to build a web app in asp.net 2.0 winforms. Id much much much prefer 3.5 MVC. because its cleaner, leaner, more modern and makes more sense to me. I know 3.5 MVC well, and have come from a Rails background, so this webforms stuff looks kinda gross to me :P.

Anyway, I need an AJAX-backed tree control, one that loads the subtrees via ajax when nodes are expanded.

In Asp MVC i would do something like making a partial representing a single node, and a jQuery AJAX triggered controller action that renders a collection of these partials(the children) which is inserted into the target's children div's innerHTML.

AFAIC, in .net 2.0 my options are:

  1. Make a Webforms control that represents a single node. Use Asp AJAX to call a codebehind method that recursivley adds controls representing the children of this node. Pros: fits well within the offical asp 2.0 framework. Pretty easy. Cons: webforms are gross(:p), and makes upgrading this site to 3.5 later much harder.

  2. Make a webservices method that returns the children as a JSON list, which are then formatted to HTML in client-side javascript, using jQuery for the requesting and formatting. Pros: Speedy due to low overheads with json. More future-proof, as json-webservices easily transition to MVC controller methods. Cons: More work to develop. HTML ends up mixed up in with the clientside javascript(because theres no JSON/javascript templating availible), which is hideous(IMHO).

  3. use a third party web control. Pros: least work(in best case). Cons: have to evalutate which one to use. may have to purchase. Learning/dealing with control api, etc.

  4. Some other way?

So what do you guys think is the best way to go?

A: 

I've been using ComponentArt's tree view. It was preety easy to pick up. The webservices support in the control is hosed currently; however, it does allow you to query a url, and it expects a simple xml document which it translates to its client side objects. Very easy and quick to get a nice fully functional conrol up and running very quickly.

For the server side I created an ASHX page which helps keep the server side overhead down to a minimum.

JoshBerke
I would never be able to get the $1000 USD(~$1600 AUD) for a licence for those tools approved, however nice they are! :p
dalyons
that sucks...I have a love hate relationship with their tools but in the end they do save me a ton of time.
JoshBerke
Give them an estimate on how long it will take to write your own tool....you never know if you make 50 bucks an hour that's only 20 hours of work it needs to save.
JoshBerke
+1  A: 

jstree.com