Asked by:
Dropdown not working on root pages but is on inner pages?

Question
-
User-183185495 posted
For some reason my drop down menus are not working in my inner pages but they are in the outter pages for example
For My profile menu I am using
For example here it will work
http://localhost:57038/MISObjects/Search
For My profile menu I am using
For example here it will work
http://localhost:57038/MISObjects
@inject SignInManager<MISSystem.Models.ApplicationUser> SignInManager @inject UserManager<MISSystem.Models.ApplicationUser> UserManager <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>MCA Case Information System - @ViewData["Title"]</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Tell the browser to be responsive to screen width --> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Toastr --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.css"> <!-- Font Awesome --> <link rel="stylesheet" href="~/font-awesome/css/all.css"> <link rel="stylesheet" href="~/font-awesome/css/brands.css"> <link rel="stylesheet" href="~/font-awesome/css/fontawesome.css"> <link rel="stylesheet" href="//unpkg.com/bootstrap-select@1.12.4/dist/css/bootstrap-select.min.css" type="text/css" /> <link rel="stylesheet" href="//unpkg.com/bootstrap-select-country@4.0.0/dist/css/bootstrap-select-country.min.css" type="text/css" /> <link rel="stylesheet" href="/css/site.css"> <!-- Ionicons --> <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <!-- DataTables --> <link href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css" rel="stylesheet" /> <link href="https://cdn.datatables.net/responsive/2.1.1/css/responsive.bootstrap.min.css" rel="stylesheet" /> <!-- Theme style --> <!-- Ionicons --> <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <!-- overlayScrollbars --> <link rel="stylesheet" href="~/dist/css/adminlte.min.css"> <!-- Google Font: Source Sans Pro --> <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet"> <!-- iCheck for checkboxes and radio inputs --> <link rel="stylesheet" href="~/plugins/icheck-bootstrap/icheck-bootstrap.min.css"> <link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://rawcdn.githack.com/dmhendricks/file-icon-vectors/master/dist/file-icon-vectors.min.css" /> <link rel="stylesheet" href="~/plugins/select2/css/select2.css"> <link rel="stylesheet" href="~/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css"> <link rel="stylesheet" href="~/flag-icon-css/css/flag-icon.css"> </head> <body class="hold-transition sidebar-mini"> <!-- Site wrapper --> @await Component.InvokeAsync("NToastNotify") <div class="wrapper"> <!-- Navbar --> <nav class="main-header navbar navbar-expand navbar-white navbar-light"> <!-- Left navbar links --> <ul class="navbar-nav"> <li class="nav-item"> <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a> </li> <!-- SEARCH FORM --> <form asp-action="Search" asp-controller="MISObjects" method="post"> <div class="input-group input-group-lg"> <select id="searchType"> <option value="1">All Cases</option> <option value="2">My Cases</option> </select> <input class="form-control form-control-navbar" type="search" id="search" name="search" placeholder="Case Number" aria-label="Search"> <div class="input-group-append"> <button class="btn btn-navbar" type="submit"> <i class="fas fa-search"></i> </button> </div> </div> </form> </ul> <!-- Right navbar links --> <ul class="navbar-nav ml-auto"> <a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity.Name!</a> <li class="nav-item dropdown"> <a class="nav-link" data-toggle="dropdown" href="#"> <i class="far fa-bell"></i> <span class="badge badge-warning navbar-badge">15</span> </a> <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right"> <span class="dropdown-item dropdown-header">15 Notifications</span> <div class="dropdown-divider"></div> <a href="#" class="dropdown-item"> <i class="fas fa-envelope mr-2"></i> 4 new messages <span class="float-right text-muted text-sm">3 mins</span> </a> <div class="dropdown-divider"></div> <a href="#" class="dropdown-item"> <i class="fas fa-users mr-2"></i> 8 friend requests <span class="float-right text-muted text-sm">12 hours</span> </a> <div class="dropdown-divider"></div> <a href="#" class="dropdown-item"> <i class="fas fa-file mr-2"></i> 3 new reports <span class="float-right text-muted text-sm">2 days</span> </a> <div class="dropdown-divider"></div> <a href="#" class="dropdown-item dropdown-footer">See All Notifications</a> </div> </li> <li class="nav-item"> <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button"> <i class="fas fa-th-large"></i> </a> </li> <!-- Notifications Dropdown Menu --> <li class="nav-item dropdown"> <a class="nav-link" data-toggle="dropdown" href="#"> <i class="fa fa-user-cog" style="font-size:24px;"></i> </a> <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right"> <a asp-action="Setup" asp-controller="Admin" asp-route-id="1" class="dropdown-item"> <i class="fa fa-users-cog mr-2"></i> Settings </a> <div class="dropdown-divider"></div> @if (User.Identity.IsAuthenticated) { <form asp-controller="MISObjects" asp-action="Logout" asp-route-returnUrl="/Home/" method="post" role="form"> <div> <button class="dropdown-item-text" type="submit" > Logout </button> </div> </form> } else { <a asp-area="Identity" asp-page="/Account/Login" class="dropdown-item dropdown-footer fa fa-sign-in-alt">Login</a> <a asp-area="Identity" asp-page="/Account/Register" class="dropdown-item dropdown-footer">Register</a> } </div> </li> </ul> </nav> <!-- /.navbar --> <!-- /.navbar --> <!-- Main Sidebar Container --> <aside class="main-sidebar sidebar-dark-primary elevation-4"> <!-- Brand Logo --> <a href="/" class="brand-link"> <span class="brand-text font-weight-light">MCA</span> </a> <!-- Sidebar --> @Html.Partial("_LeftMenuPartial.cshtml") <!-- /.sidebar --> </aside> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> </div> <div class="col-sm-6"> <ol class="breadcrumb float-sm-left"> <li class="breadcrumb-item"><a href="#">Home</a></li> </ol> </div> </div> </div><!-- /.container-fluid --> </section> <section class="content"> @if (User.IsInRole("admin")) { } <div class="container-fluid"> <!-- Small boxes (Stat box) --> <div class="row"> <div class="col-lg-3 col-6"> <!-- small box --> <div class="small-box bg-info"> <div class="inner"> <h3>@ViewBag.CasesCount</h3> </div> <div class="icon"> <i class="fa fa-briefcase"></i> </div> <a href="" class="small-box-footer"> Your Cases </a> </div> </div> <!-- ./col --> <div class="col-lg-3 col-6"> <!-- small box --> <div class="small-box bg-success"> <div class="inner"> <h3>0</h3> </div> <div class="icon"> <i class="fa fa-clock"></i> </div> <a href="" class="small-box-footer"> Last Modifed Cases < 7 </a> </div> </div> <!-- ./col --> <div class="col-lg-3 col-6"> <!-- small box --> <div class="small-box bg-warning"> <div class="inner"> <h3>2</h3> </div> <div class="icon"> <i class="fa fa-bell"></i> </div> <a href="" class="small-box-footer"> Overtdue Reminders > 30 </a> </div> </div> <div class="col-lg-3 col-6"> <!-- small box --> <div class="small-box bg-danger"> <div class="inner"> <h3>@ViewBag.NotificationCount</h3> </div> <div class="icon"> <i class="fa fa-envelope-o"></i> </div> <a href="/MISObjects/" class="small-box-footer"> Call to Actions </a> </div> </div> </div> </div> @RenderBody() <!-- /.content-wrapper --> <footer class="main-footer"> <div class="float-right d-none d-sm-block"> <b>Version</b> 1.0.5 (Alpha) </div> </footer> </section> <!-- Control Sidebar --> <aside class="control-sidebar control-sidebar-dark"> <!-- Control sidebar content goes here --> </aside> <!-- /.control-sidebar --> </div> </div> <!-- ./wrapper --> <!-- jQuery --> <script type="text/javascript" src="~/lib/jquery/dist/jquery.js"></script> <!-- Bootstrap 4 --> <script src="~/plugins/bootstrap/js/bootstrap.bundle.min.js"></script> <!-- AdminLTE App --> <script src="~/dist/js/adminlte.min.js"></script> <!-- AdminLTE for demo purposes --> <script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap4.min.js "></script> <script src="~/plugins/jquery-validation/jquery.validate.js" type="text/javascript"></script> <script src="~/plugins/jquery-validation/additional-methods.min.js"></script> <script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js" type="text/javascript"></script> <!-- bootstrap color picker --> <!-- Bootstrap Switch --> <script src="~/plugins/bootstrap-switch/js/bootstrap-switch.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"></script> <script src="~/font-awesome/js/all.js"></script> <script src="~/font-awesome/js/brands.js"></script> <script src="~/font-awesome/js/fontawesome.js"></script> <script src="~/plugins/select2/js/select2.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script> @RenderSection("Scripts", required: false) <environment include="Development"> <script src="~/js/site.js" asp-append-version="true" defer></script> </environment> <environment exclude="Development"> <script src="~/js/site.min.js" asp-append-version="true" defer></script> </environment> <style> button.link { font-family: "Verdana" sans-serif; font-size: 1em; text-align: left; color: blue; background: none; margin: 0; padding: 0; border: none; cursor: pointer; -moz-user-select: text; /* override all your button styles here if there are any others */ } button.link span { text-decoration: underline; } button.link:hover span, button.link:focus span { color: black; } </style> <script> (function () { $("#selectLanguage select").change(function () { $(this).parent().submit(); }); }()); $('select[name ="culture"] > option').each(function () { var country = $( '<span class="flag-icon flag-icon-' + country.id.toLowerCase() + ' flag-icon-squared"></span>' + '<span class="flag-text">' + country.text + "</span>" ); $(this).html(country); }) </script> <script> $(function () { $("#ddCat").change(function () { $.getJSON("/MISObjects/GetEnforcementTypes", { cid: $("#ddCat").val() }, function (d) { var row = ""; $("#ddType").empty(); $.each(d, function (i, v) { row += "<option value=" + v.value + ">" + v.text + "</option>"; }); $("#ddType").html(row); }) }) $("#ddType").change(function () { $.getJSON("/MISObjects/GetEnforcementsItem", { Sid: $("#ddType").val() }, function (d) { var row = ""; $("#dditem").empty(); $.each(d, function (i, v) { row += "<option value=" + v.value + ">" + v.text + "</option>"; }); $("#dditem").html(row); }) }) }) </script> <script> $(function () { $(".open-AuditTrailPopupPartial").click(function () { $('#DestinationUserId').val($(this).data('id')); $('#AuditTrailPopupPartial').modal('show'); }); $(".open-AddBookDialog").click(function () { $('#DestinationUserId').val($(this).data('id')); $('#CaseId').val($(this).data('caseId')); $('#UpdatePopupPartial').modal('show'); }); $(".open-FileUploadPartialModal").click(function () { $('#FileUploadPartialModal').modal('show'); }); $(".open-Notes2EditPopupPartial").click(function () { $('#DestinationUserId').val($(this).data('id')); $('#Notes2EditPopupPartial').modal('show'); }); }); </script> <script> $(function () { $("#ddType").change(function () { $.getJSON("/MISObjects/GetEnforcementType", { cid: 1 }, function (d) { var row = ""; $("#ddCat").empty(); $.each(d, function (i, v) { row += "<option value=" + v.value + ">" + v.text + "</option>"; }); $("#ddCat").html(row); }) }) $("#ddCat").change(function () { $.getJSON("/MISObjects/GetEnforcements", { Sid: $("#ddCat").val() }, function (d) { var row = ""; $("#dditem").empty(); $.each(d, function (i, v) { row += "<option value=" + v.value + ">" + v.text + "</option>"; }); $("#dditem").html(row); }) }) }) </script> } <script> function UploadDcoument() { $("#UploadDocumentPopup").modal("show") } </script> <script> $(document).ready(function () { const url = window.location; $('ul.nav-sidebar a').filter(function () { return this.href == url; }).parent().addClass('active'); $('ul.nav-treeview a').filter(function () { return this.href == url; }).parentsUntil(".sidebar-menu > .nav-treeview").addClass('menu-open'); $('ul.nav-treeview a').filter(function () { return this.href == url; }).addClass('active'); $('li.has-treeview a').filter(function () { return this.href == url; }).addClass('active'); $('ul.nav-treeview a').filter(function () { return this.href == url; }).parentsUntil(".sidebar-menu > .nav-treeview").children(0).addClass('active'); }); </script> <script> $(document).ready(function () { var id = @ViewBag.CaseId; $("#audTrailTable").DataTable({ "ajax": { url: "/MISObjects/GetAuditTrailData/" + id, type: "get", database: "json" }, "columns": [ { "data": "createdDate" }, { "data": "createdBy" }, { "data": "action" } ], "scrollY": "200px", "scrollCollapse": true, "paging": false, "processing": true, // for show progress bar "filter": true, // this is for disable filter (search box) "orderMulti": false // for disable multiple column at once }) }); </script> </body> </html>
I have no errors in my console either so I am dumfound as to why its not working
My Map Controller route is
endpoints.MapControllerRoute( name: "default", pattern: "{controller=MISObjects}/{action=Index}/{id?}"); endpoints.MapRazorPages(); });
I dont want the default which is
endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapRazorPages(); });
But maybe that is screwing up my references some how from loading correctly?
Saturday, August 8, 2020 7:56 PM
All replies
-
User711641945 posted
Hi roguenidb,
For example here it will work http://localhost:57038/MISObjects/Search
For My profile menu I am using
For example here it will work
http://localhost:57038/MISObjects
Which one did you work?
And I am not sure what is your inner page and root page.Did you mean the dropdown list could work in MISObjects view,but when you click the submit button to search the value,it could not work?Or you use partial view or not?
I have another doubt that what is `does not work` mean?The dropdownlist could not render the options?Or when you choose the dropdownlist option and submit the value it could not return the correspoding data?
Best Regards,
Rena
Monday, August 10, 2020 8:08 AM -
User-183185495 posted
On This page it will work
http://localhost:57038/MISObjects/Search
And yes the dropdown will not show any part it will just display the icon and the arrow but wont drop down
Hi roguenidb,
roguenidb
For example here it will work http://localhost:57038/MISObjects/Search
For My profile menu I am using
For example here it will work
http://localhost:57038/MISObjects
Which one did you work?
And I am not sure what is your inner page and root page.Did you mean the dropdown list could work in MISObjects view,but when you click the submit button to search the value,it could not work?Or you use partial view or not?
I have another doubt that what is `does not work` mean?The dropdownlist could not render the options?Or when you choose the dropdownlist option and submit the value it could not return the correspoding data?
Best Regards,
Rena
Monday, August 10, 2020 8:31 AM -
User711641945 posted
Hi roguenidb,
I have some doubts for reproducing your issue:
1.Could you share your root pages' razor view and your inner pages' razor view?
2.Could you share your corresponding actions?
3.It seems the dropdown could not drop down in MISObjects which is your root pages,right?
4.And if what you share is the MISObjects(root pages),I see that it contains a form which post to the Search action.I think it will post back the Search razor view and it is the inner pages,right?
5.But If the shared view is root pages,I see the two dropdownlist is filled with data manually.It seems must to be drop down.So I am confused with `drop down`'s meaning.Does it mean when you select the dropdown list it has no data?
I think you could share a screenshot or gif how did you do operations.It would be better for us to understand your requirement.
Best Regards,
Rena
Tuesday, August 11, 2020 9:26 AM