Topic: Problems with MDBoostrap and .Net Core 2.2
tFilip free asked 5 years ago
Hello, I have troubles with getting MDB to work. I am using it on ASP.NET, but I have issues on .net core. I have already figured out, so I need to use static files in configure. as is:
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"css")),
RequestPath = new PathString("/css")
});
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"js")),
RequestPath = new PathString("/js")
});
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"scss")),
RequestPath = new PathString("/scss")
});
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"font")),
RequestPath = new PathString("/font")
});
I get the visuals and all, but dropdown as this:
<!--Dropdown primary-->
<div class="dropdown">
<!--Trigger-->
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Material dropdown
</button>
<!--Menu-->
<div class="dropdown-menu dropdown-primary">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
<!--/Dropdown primary-->
Wont simply work, neither modal etc. There must be something not getting referenced. (no errors in console)
Any ideas? I am kinda lost.
tFilip free answered 5 years ago
Yes. I am sure. Eventually I got it working, but I had to skip:
<script type="text/javascript" src="js/bootstrap.min.js"></script>
Without it everything works. But when I add this all js stops working.
Sebastian Kaczmarek staff commented 5 years ago
That's odd. Can you please confirm that the order of the scripts being loaded is correct? By correct I mean: jQuery -> Popper -> Bootstrap -> MDB.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.6.1
- Device: PC
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Sebastian Kaczmarek staff commented 5 years ago
Please make sure that all MDB files are being loaded - specifically, all required JS files. Are you 100% sure that those are being loaded? You can check it in the
Sources
or theNetwork
tab in the Chrome DevTools. Please let me knowtFilip free commented 5 years ago
Sorry, from my phone I had to answer you as an answer, I couldnt format code otherwise.