【问题标题】:How to Navigate a website using Treeview by DevExpressDevExpress 如何使用 Treeview 浏览网站
【发布时间】:2014-09-23 09:50:38
【问题描述】:

我目前正在使用 DevExpress 的 TreeView,它被用来在我的 ASP mvc 站点中导航。

但是,阅读docs,我似乎找不到任何对实际导航的引用,尤其是当我从xml 文件中绑定数据时。

我的ContentLeftPartialView

<div class="leftPanel">
        @* DXCOMMENT: Configure the left panel's treeview *@
    @Html.DevExpress().TreeView(settings => {
        settings.Name = "LeftTreeView";
    }).BindToXML(HttpContext.Current.Server.MapPath("~/App_Data/SideMenu.xml"), "/menu/*").GetHtml()
</div>

了解我的xml 存在的基础

<?xml version="1.0" encoding="utf-8" ?>
<menu>
  <group Text="Graphics">
    <item Text="General Overview" />
  </group>
  <group Text="Reports">
    <item Text="Report Manager" />
    <item Text="Product Delivery Report" />
    <item Text="Inventory Report" />
    <item Text="Stock Report" />
  </group>
 <group Text="Stocks">
    <item Text="stock 1" />
    <item Text="stock 2" />
  </group>
 <group Text="Systems">
    <item Text="system 1" />
    <item Text="system 2" />
  </group>
 <group Text="Lock Interface">
  </group>
   <group Text="Settings">
  </group>
</menu>

我完全不知道应该将ActionLinks/etc 放在哪里,以便能够浏览我的网站(此面板将在所有页面中保持不变)。

有没有人对 DevExpress 的 HTML 5 / MVC 有任何经验来为我指明正确的方向?

我知道另一个项目使用了这个:

 public ActionResult Products()
        {
            ViewBag.Message = "Your Products page.";

            return View();
        }

但它只是使用了如下链接:

 <li>@Html.ActionLink("Products", "Index", "Products")</li>

我认为 DevExpress 的局部视图树视图不会发生这种情况。

【问题讨论】:

    标签: c# asp.net-mvc treeview devexpress devexpress-mvc


    【解决方案1】:

    我发现了如何在 xml 文件中使用 NavigateUrl 进行导航,尽管这不是我想要放置它的确切位置(我更愿意动态添加它)。

    但是,使用:

     <group Text="Graphics">
        <item Text="General Overview" NavigateUrl="/mygraphicsPage"/>
     </group>
    

    允许我按treeview 上的“一般概述”,它将导航到“mygraphicsPage.cshtml”。

    所以重要的页面是添加

    NavigateUrl="myurl" to the items.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-07
      • 1970-01-01
      • 2013-06-07
      • 1970-01-01
      • 1970-01-01
      • 2016-01-01
      • 1970-01-01
      • 2023-03-30
      相关资源
      最近更新 更多