Got more questions? Find advice on: SQL | XML | Regular Expressions | Windows
in Search
Welcome to AspAdvice Sign in | Join | Help

In the Trenches

Joe's Thoughts

ASP.NET Treeview 2.0, Javascript madness and more

What can I say, I’m not happy.

 

First let’s look at sub classing; this must be an issue with more web controls. You would think they (ASP.NET Team) would have made the controls smart enough to serialize to view state the exact types in the object.

 

Here is what happened to me, I used the treeview control, I sub classed the treenode and added a couple new simple properties. Well I expected on post back to up cast the selected node to my sub classed treenode. Guess what happened, it was just a regular treenode. It appears on postback that it reconstructs the treeview but uses base classes to do it.

 

If this is going to be how things work, why bother allowing sub classed objects, I know it might be a pain but give some warning. It appears that the only way you can have a sub classed treenode is to customize the control to control how it serializes to view state and un-serializes from view state, this is way to much WORK!!!!!

 

So needless to say, don’t subclass a control and expect view state to work right away.

 

Some other interesting things I have found that drive me crazy. Why doesn’t Firefox support ondrag event, the only solution is a crazy mix of using onmousemove, onmousedown, onmouseup and onmouseout. Just to duplicate the same effect. So far I have looked at several frameworks, some of which I want to make known here. A good friend William Rawls had passed me these interesting links.

 

dojo: http://dojotoolkit.org/
prototype: http://prototype.conio.net/
using prototype: http://www.sergiopereira.com/articles/prototype.js.html or http://prototypedoc.com/
scritalicious: http://script.aculo.us/
zend framework: http://framework.zend.com/

 

Now you might be wondering how I got into the whole ondrag issue rant. Well I was trying to resize a table column (at runtime). Now I didn’t want to use frames (which would have worked) because, everyone seems to hate them or recommends not using them. The one excuse I hear is because it doesn’t index well. My main problem is that I wanted it to work within a usercontrol. The solutions I first came up with worked with MS IE. Then after trying it in FF I found out it didn’t work. So I revise all the code and try to get it to work using several of the events above, still no worky, there are so many differences in how IE reads JS and FF(and others like FF) read JS. There really needs to be a good cross browser IDE for this stuff, I’ve did a quick search on google but nothing popped up.

 

My solution came in the form of this nice little DnD JS framework with other features.

http://www.walterzorn.com/dragdrop/dragdrop_e.htm

Now I hadn’t explored all of its wonders yet, but I really like it.

 

I also want to note one other site:

http://swik.net/JavaScript?popular

 

This site seems to have a load of nice JavaScript frameworks all indexed on this page.

 

Ok, my last beef. What are they thinking? I’m here plugging along in VS (visual studio 2k5) and I want a treenode when clicked to hit an IFrame to load a page. Well I set the target to the ID of the IFrame and the navigateURL to what I want loaded in the IFrame. It never works, so at some point I remembered that you have to set the Name property of the IFrame, now I had it like that originally but VS complained that it didn’t meet XML 1.0 something or other framework. Also that it was considered outdated, but guess what, if the name is set then all works. So I don’t know, why say something is outdated if it just doesn’t work any other way. Not sure if this is a Treeview issue or what. I tell you something else. If I have a value set for the treenode, I expect that when clicked that the value will be sent to the IFrame as a query parameter (but it doesn’t) I have to set what I want sent, which bites.

 

I hope this helps others, as my adventure back into ASP.NET development is painful at best. I still don’t know why people put up with such limited interfaces or why the controls we have so far to work with from MS in VS are so crude. Not one tabbed control, not one splitter control. Not even a decent JS framework for use in our apps that would take care of a lot of this.

 

Also did I say how much I hate how some third party vendors sell their wares, really! Think about it, most of them sell it at not per developer license but rather per site (though keep in mind each developer that runs stuff on their on PC has to have their own version). This totally doesn’t work when you do sites for several clients, each are required to pay that price. Doesn’t anyone else see this as unfair pricing?

 

Anyways, these are my thoughts and they do not reflect the thoughts of my employer.

 

I also want to note, if anyone is looking for a job, I know several people looking, including my new employer.

 

You might be wondering how things are going with my new employer, well they are going good. I do worry though, had some thoughts passed along that disturb me. Though for me, everything has its place and use. For I know where I want to go in the coming years. Either I would like to work for MS (designing IDE’s or controls/components for upcoming versions) or getting my www.connectblocks project off the ground and get that to start producing.

 

For those of you who wonder how things are going with my www.conectblocks.com project, wonder no more. It’s still being worked on and I’m taking full control over the project myself. This means that as soon as some of the bugs get worked out and the documentation is done, it will go to market, look for it either late this year or early next year. Though you can download the beta at anytime.

 

Enjoy your life, you only have one to live.

 

Joe

 

 

 

Published Thursday, August 10, 2006 11:00 AM by jfuentes

Comments

 

Steven Corry, Developer said:

The TreeView control in ASP.NET 2.0 offers some pretty cool functionality for organizing information...

April 25, 2007 9:17 PM
Anonymous comments are disabled

About jfuentes

Jose Fuentes is the Co-Founder of the Capital City .NET Users Group of Florida, he helped organized and build the community and community web site (www.tlhdotnet.net). He’s an active MVP (Most Valuable Professional) for Microsoft, and strongly involved in the .NET community. He gives presentations and loves helping others with problems. You can find many of his posts and work on www.aspalliance.com, www.planet-source-code.com and www.windowsforms.com. He’s an active columnist for the asp alliance and Co-Authored in the ASP.NET Cook Book and currently working on a Smart Client book. His experience in .NET spans back to the early days of the first beta and he has a passion to spread the word to as many welcoming and un-welcoming ears that he can. Specializes in VB.NET and windows applications (rich client/smart client), also very knowledgeable of VS 2005 (been in beta since July 2003, after being invited to Microsoft). He’s very handy with MS SQL server 2000 and MSDE.