Board Logo

ASP Filesystem listing - need name only, not link
lwoods - 8/29/2007 at 02:33 PM

I want to be able to select a file from the Tree, but I don't want a link generated. Possibly generate an OnClick with the filename being passed to a javascript that I would write.

How?

TIA


tigra - 8/29/2007 at 03:13 PM

you can call javascript from the link of the item without page reload. Here's the note from the documentation page:

- Any code appropriate for HREF attribute of the anchor (<a ..>) can be specified in link field of tree item (http://, ftp://, javascript:, etc.)

so you can basically do something like:

["Home", "javascript:myFunction('index.html')"]


lwoods - 8/29/2007 at 06:50 PM

Well, yes,...maybe. I need to have the filename "plugged into" the javascript call. Your examples shows pulling in a constant filename. At least I have tried various methods and can't force the object name. I even changed the ASP code and it looks like your javascript tree building code overrode my changes. Anyway, give me some more ideas....


lwoods - 8/30/2007 at 02:03 PM

I want to add a little more detail about what I am looking for...

I want to list the tree, then I want to know which file a person selected (clicked on) in the tree. This could be handled with an "onclick" event or I could handle it with a javascript function in an href link.

How?

TIA


tigra - 8/30/2007 at 03:49 PM

The code sample I provided answers your question about calling the function on item click:

["Home", "javascript:myFunction('index.html')"]

This code will call function myFunction with 'index.html' passed as parameter. With the items structure generated by the server side script you'll need to replace the static parameter with the asp output i.e.

["<%= Caption %>", "javascript:myFunction('<%= Filename %>')" ...

Those are the sample variable names, they may be different in your ASP implementation.


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/