This is a migrated thread and some comments may be shown as answers.

[Solved] Menu stops working when navigating to certain Views

0 Answers 85 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Neil Watts
Top achievements
Rank 1
Neil Watts asked on 24 Jul 2012, 06:18 PM
Hello,

I have an mvc3 razor project. In my _Layout,cshtml I have a telerik menu.

It works fine in all my views except for 2 of them. When I navigate to those 2 everything works great, but after I do a search and display date in my telerik grid the menus will no longer work, The only Menu Item that works is the Home tab.

I have other views with telerik grids and there are no problems on those pages.

Here is my menu from the _Layout.cshtml

@(Html.Telerik().Menu()
    .HtmlAttributes(new { style = "text-align: left; font-family:Futura Bk; float:left; width: 100%" })
    .Name("menu")
    .Items(menu =>
    {
        menu.Add()
            .Text("Home")
            .Action("Index", "Home")
            .Url("/Highlander/Home/Index");
        menu.Add()
          .Text("Order Manager")
          .Items(item =>
          {
              item.Add()
                  .Text("Order Manager")
                  .Action("Index", "OrderManager", new { area = "Highlander" });
          });
        menu.Add()
            .Text("Supply Chain Manager")
                .Items(item =>
                {
                    item.Add()
                        .Text("Build Manager")
                        .Action("BuildManager", "SupplyChain", new { area = "Highlander" });
                    item.Add()
                        .Text("Build Quantity")
                        .Action("BuildQuantity", "SupplyChain", new { area = "Highlander" });
                });
        menu.Add()
            .Text("Delivery Manager")
                .Items(item =>
                {
                    item.Add()
                        .Text("Deliveries")
                        .Action("DeliveryManager", "Deliveries", new { area = "Highlander" });
                });
 
        menu.Add()
            .Text("System Summary")
                .Items(item =>
                {
                    //            item.Add()
                    //                .Text("All Systems")
                    //                .Action("Index", "Systems", new { area = "Highlander" });
                    item.Add()
                        .Text("System Summary")
                        .Action("Index", "SystemSummary", new { area = "Highlander" });
                    //            item.Add()
                    //                .Text("Systems by Build. Sub Assembly View for NPI")
                    //                .Action("Index", "Build", new { area = "Highlander" });
                    //            item.Add()
                    //                .Text("Systems by Build. Sub Assembly View for NPI (Rotated)")
                    //                .Action("Index", "Build", new { area = "Highlander" });
                });
 
        //});
        menu.Add()
          .Text("Setup")
          .Items(item =>
          {
              item.Add()
                  .Text("Builds")
                  .Items(child =>
                  {
                      child.Add()
                          .Text("View")
                          .Action("Index", "Build", new { area = "Highlander" });
                      child.Add()
                          .Text("Add Build")
                          .Action("Create", "Build", new { area = "Highlander" });
                      child.Add()
                          .Text("Build Templates")
                          .Action("CreateBuildComponents", "Build", new { area = "Highlander" });
                      child.Add()
                          .Text("Attach Sub Assemblies")
                          .Action("AttachSubAssemblies", "BuildManager", new { area = "Highlander" });
                  });
              item.Add()
                  .Text("Programs")
                  .Items(child =>
                  {
                      child.Add()
                          .Text("View")
                          .Action("Index", "Programs", new { area = "Highlander" });
                      child.Add()
                          .Text("Add")
                          .Action("Create", "Programs", new { area = "Highlander" });
                  });
              item.Add()
                  .Text("Assemblies")
                  .Items(child =>
                  {
                      child.Add()
                          .Text("View")
                          .Items(gchild =>
                          {
                              gchild.Add()
                                  .Text("Assemblies")
                                  .Action("Index", "Assembly", new { area = "Highlander" });
                              gchild.Add()
                                  .Text("Assembly Types")
                                  .Action("AssemblyTypes", "Assembly", new { area = "Highlander" });
                              gchild.Add()
                                  .Text("Sub Assemblies")
                                  .Action("Index", "SubAssembly", new { area = "Highlander" });
                              gchild.Add()
                                  .Text("Sub Assembly Types")
                                  .Action("SubAssemblyTypes", "SubAssembly", new { area = "Highlander" });
                          });
                      child.Add()
                          .Text("Add")
                          .Items(gchild =>
                          {
                              gchild.Add()
                                  .Text("Assemblies")
                                  .Action("Index", "Assembly", new { area = "Highlander" });
                              gchild.Add()
                                  .Text("Assembly Types")
                                  .Action("CreateAssemblyType", "Assembly", new { area = "Highlander" });
                              gchild.Add()
                                  .Text("Sub Assemblies")
                                  .Action("Create", "SubAssembly", new { area = "Highlander" });
                              gchild.Add()
                                  .Text("Sub Assembly Types")
                                  .Action("CreateSubAssemblyType", "SubAssembly", new { area = "Highlander" });
                          });
                  });
              item.Add()
                  .Text("Partner Organization")
                  .Items(child =>
                  {
                      child.Add()
                          .Text("View")
                          .Action("Index", "Owners", new { area = "Highlander" });
                      child.Add()
                          .Text("Add")
                          .Action("Create", "Owners", new { area = "Highlander" });
                  });
              item.Add()
                  .Text("Users")
                  .Items(child =>
                  {
                      child.Add()
                          .Text("View")
                          .Action("Index", "Users", new { area = "Highlander" });
                      child.Add()
                          .Text("Add")
                          .Action("Create", "Users", new { area = "Highlander" });
                      child.Add()
                          .Text("Users Needing Access")
                          .Action("UsersNeedingAccess", "Users", new { area = "Highlander" });
                  });
              item.Add()
                  .Text("Host Names")
                  .Items(child =>
                  {
                      child.Add()
                          .Text("View")
                          .Action("Index", "HostNames", new { area = "Highlander" });
                      child.Add()
                          .Text("Add")
                          .Action("Create", "HostNames", new { area = "Highlander" });
                  });
              item.Add()
                  .Text("Locations")
                  .Items(child =>
                  {
                      child.Add()
                          .Text("View")
                          .Action("Index", "Location", new { area = "Highlander" });
                      child.Add()
                          .Text("Add")
                          .Action("Create", "Location", new { area = "Highlander" });
                  });
          });
        menu.Add()
            .Text("Excel")
            .Items(item =>
            {
                item.Add()
                    .Text("Upload")
                    .Action("Index", "Excel", new { area = "Highlander" });
                //item.Add()
                //    .Text("Download")
                //    .Action("ExcelDown", "Excel", new { area = "Highlander" });
            });
    }))

My views that contain the grids are basically identical. They all use a dynamic gridviewmodel etc.

Here is the grid from the page that works
@if (@Model != null)
{
    @(Html.Telerik().Grid<System.Data.DataRow>(Model.Data.Rows.Cast<System.Data.DataRow>()).HtmlAttributes(new { style = "width: 1000px" })
          .Name("SCBQGrid")
          .Columns(columns =>
          {
              columns.LoadSettings(Model.Columns as IEnumerable<GridColumnSettings>);
          })
          .DataBinding(dataBinding => dataBinding.Server()
                      .Select("_SupplyChainBuildQtyCustomBinding", "SupplyChain")
                      .Update("_SupplyChainBuildQtyCustomBinding", "SupplyChain"))
          .Editable(editing => editing.Mode(GridEditMode.InLine))
          .Sortable(settings => settings.Enabled(true))
          .Scrollable(c => c.Height("500px"))
          .EnableCustomBinding(true)
          .Resizable(resize => resize.Columns(true))
      )
}

Here is the grid from one of the views that causes the menu to stop woriking
@(Html.Telerik().Grid<System.Data.DataRow>(Model.Data.Rows.Cast<System.Data.DataRow>())
        .HtmlAttributes(new { style = "width: 2500px" })
        .Name("Grid")
        .ToolBar(tb => tb.Template("Outstanding Orders"))
        .DataKeys(dataKeys => dataKeys.Add("DeliveryID"))
        .Columns(columns =>
        {
            columns.Command(commandbutton =>
            {
                commandbutton.Select().ButtonType(GridButtonType.ImageAndText).HtmlAttributes(new { style = "width: 60px; min-width: 40px; background: #0066FF" });
            }).Width(120).Title(ViewBag.Mark);
            columns.LoadSettings(Model.Columns as IEnumerable<GridColumnSettings>);
        })
        .RowAction(row =>
        {
            if (row.Index < 2)
            {
                row.HtmlAttributes["style"] = "background:#336699;";
            }
        })
       .DataBinding(dataBinding => dataBinding.Server()
                .Select("_DeliveryGrid", "Deliveries")
                .Update("_DeliveryGrid", "Deliveries"))
        .Editable(editing => editing.Mode(GridEditMode.InLine))
        .Sortable(settings => settings.Enabled(true))
        .Scrollable(c => c.Height("9000px"))
        .EnableCustomBinding(true)
        .Resizable(resize => resize.Columns(true))
 )

Any help would be greatly appreciated.
Tags
Menu
Asked by
Neil Watts
Top achievements
Rank 1
Share this question
or