This question is locked. New answers and comments are not allowed.
I am working with a LoadOnDemand TreeView and I noticed that setting a Url property for a dynamically loaded field does not get reflected/wired up in the rendered output.
Checking the JSON returned I can confirm that the Url is being sent in the response, however the rendered nodes do not have an href: value set:
| public ActionResult GetFiles(TreeViewItem node) { |
| string appPath = Server.MapPath("~/"); |
| Predicate<string> nameFilter = p => p != ".svn"; |
| Func<string, string> pathSelector = p => p.Replace(appPath, "/").Replace(Path.DirectorySeparatorChar, '/'); |
| if (node == null || string.IsNullOrEmpty(node.Value)) { |
| string path = Server.MapPath("~/Content/UserFiles/Files/_private"); |
| var items = SafeIO.GetDirectoryTree(path, SearchOption.TopDirectoryOnly, nameFilter, pathSelector); |
| return View("DisplayTemplates/DirectoryTree", items.ToArray()); |
| } |
| else { |
| string path = Server.MapPath("~" + node.Value); |
| var nodes = SafeIO.GetDirectoryTree(path, SearchOption.TopDirectoryOnly, nameFilter, pathSelector) |
| .Select(pathItem => new TreeViewItem() { |
| Text = pathItem.Name, |
| Value = pathItem.FullPath, |
| Url = (pathItem is FileItem) ? pathItem.FullPath : null, |
| LoadOnDemand = (pathItem is DirectoryItem), |
| Enabled = true |
| }); |
| return Json(nodes.ToArray()); |
| } |
| } |
Checking the JSON returned I can confirm that the Url is being sent in the response, however the rendered nodes do not have an href: value set:
| [{"Items":[], |
| "Value":"/Content/UserFiles/Files/_private/Foo/shippingapicredentials.txt", |
| "Text":"shippingapicredentials.txt", |
| "Url":"/Content/UserFiles/Files/_private/Foo/shippingapicredentials.txt", |
| "LoadOnDemand":false, |
| "Expanded":false,"Checked":false,"RouteName":null,"HtmlAttributes":[],"ImageHtmlAttributes":[],"LinkHtmlAttributes":[],"Visible":true,"ImageUrl":null,"SpriteCssClasses":null,"Selected":false,"Enabled":true,"ControllerName":null,"ActionName":null,"RouteValues":[],"ContentHtmlAttributes":[],"Content":null,"Parent":null,"PreviousSibling":null,"NextSibling":null}] |
| <ul class="t-group" style="display: block;"> |
| <li class="t-item t-last"> |
| <div class="t-bot"> |
| <span class="t-in t-state-selected">shippingapicredentials.txt</span></div> |
| <input type="hidden" value="/Content/UserFiles/Files/_private/Foo/shippingapicredentials.txt" |
| name="itemValue" class="t-input"></li></ul> |