ASP.NET MVC 4 issues with including external javascript -


i'm new in mvc , got stuck using downloaded javascript controller in partial view. downloaded treeview:
http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
placed treeview.js , demo.js scripts in project, css , images folder. 2 .js files in /scripts/treeview folder , css , images folder in /content folder.

added these bundleconfig.cs:

        bundles.add(new scriptbundle("~/bundles/treeview").include(                     "~/scripts/treeview/jquery.treeview.js",                     "~/scripts/treeview/demo.js"));          bundles.add(new stylebundle("~/content/css/treewiew").include("~/content/jquery.treeview.css")); 

my partial view looks this:

<ul id="browser" class="treeview">     <li><span class="folder">folder 1</span>         <ul>             <li><span class="file">item 1.1</span></li>         </ul>     </li>     <li><span class="folder">folder 2</span>         <ul>             <li><span class="folder">subfolder 2.1</span>                 <ul id="folder21">                     <li><span class="file">file 2.1.1</span></li>                     <li><span class="file">file 2.1.2</span></li>                 </ul>             </li>             <li><span class="file">file 2.2</span></li>         </ul>     </li>     <li class="closed"><span class="folder">folder 3 (closed @ start)</span>         <ul>             <li><span class="file">file 3.1</span></li>         </ul>     </li>     <li><span class="file">file 4</span></li> 

in _layout.cshtml added these 2 lines in head section, before @styles.render("~/content/css") , @scripts.render("~/bundles/modernizr") lines:

<link href="@url.content("~/content/jquery.treeview.css")" rel="stylesheet" type="text/css" /> <script runat="server" type="text/javascript" src="@url.content("~/scripts/treeview/jquery.treeview.js")"></script> 

and lastly, call partial view in index view, generated automatically project. css works fine, i've got styled list, doesn't functional tree view controller.

now, found these posts, these weren't able me:
how include javascript code in asp.net mvc4 view page?
mvc4 partial view javascript bundling issue

i can't see what's problem @ me. i've started learn javascript recently, mvc totally new , unknown me 5 days before, , stuck problem 3 days , i'm angry @ myself that. please, me! lot!

add line instead of using script registration,

@scripts.render("~/bundles/jquery")     @scripts.render("~/bundles/treeview") 

note: treeview should register after jquery reference.


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -