开发者

I am totally unable to add a fileTree (JQuery fileTree addon) to my asp.net page

okay, so i have an asp.net (C#) application and i want to add a list of file and folders on the page, so i figured i should use JQuery fileTree (http://abeautifulsite.net/2008/03/jquery-file-tree/#download)

but now i am totally unable to display the file list.

I initialise the page this way:

Site.Master:

<link rel="stylesheet" type="text/css" href="../../Content/superfish.css" media="screen">
<link href="../../Content/jqueryFileTree.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="../../Scripts/jqueryF开发者_如何学PythonileTree.js" type="text/javascript"></script>
<script src="../../Scripts/JqueryUI/js/jquery-ui-1.8.1.custom.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../../Scripts/jquery.dataTables.js"></script>
<script type="text/javascript" src="../../Scripts/superfish.js"></script>

    <script type="text/javascript">

        $(document).ready(function() {
        test = $('#fileTree').fileTree({script: "jqueryFileTree.aspx" }, function(file) {
            openFile(file);
            });

            $("button").button();

            oTable = $('#data').dataTable({
                "bJQueryUI": true,
                "sPaginationType": "full_numbers",
                "bSort": true
            });


        });
     </script>

and in the page, i put my div this way:

<div id="fileTree">

but i'm positive that jqueryFileTree.aspx is never "called" because if i return this page in my controller, it shows the list of files/folder correctly, so it's also not a problem with my aspx connector...

Also i checked, on the JS console, it gives no error and there is nothing more in the page source code

i've been trying to solve this all day without success so your help is apreciated

Edit: formatting problems As Requested, Posting jQueryFileTree.aspx:

string dir;
if(Request.Form["dir"] == null || Request.Form["dir"].Length <= 0)
    dir = "/";
else
    dir = Server.UrlDecode(Request.Form["dir"]);
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dir);
Response.Write("<ul class=\"jqueryFileTree\" style=\"display: none;\">\n");
foreach (System.IO.DirectoryInfo di_child in di.GetDirectories())
    Response.Write("\t<li class=\"directory collapsed\"><a href=\"#\" rel=\"" + dir + di_child.Name + "/\">" + di_child.Name + "</a></li>\n");
foreach (System.IO.FileInfo fi in di.GetFiles())
{
    string ext = ""; 
    if(fi.Extension.Length > 1)
        ext = fi.Extension.Substring(1).ToLower();

    Response.Write("\t<li class=\"file ext_" + ext + "\"><a href=\"#\" rel=\"" + dir + fi.Name + "\">" + fi.Name + "</a></li>\n");      
}
Response.Write("</ul>");


This may be completely unrelated, but make sure you close your very first link tag with a /> at the end.

<link rel="stylesheet" type="text/css" href="../../Content/superfish.css" media="screen" />

Are you sure your javascript is getting called? Try putting an alert("<sample debug message here>") or two in your document.ready function and see if anything is getting called at all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜