Modern UI Styling for ASP.NET MVC with Metro Design

I am interested in incorporating the METRO UI CSS into my application:

  1. Begin by creating an ASP NET MVC Project

  2. To download METRO UI MVC, follow these steps:

Package Manager Console: PM> Install-Package Metro.UI.CSS

  1. Adjust the bundles to include the following components:

            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                            "~/Scripts/jquery-{version}.js",
                            "~/Scripts/metro-ui/jquery.ui.widget.js",
                            "~/Scripts/metro-ui/metro.min.js"
                            ));
    
            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*",
                        "~/Scripts/metro-ui/jquery.ui.widget.js"
                        ));
    
            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));
    
            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/respond.js"));
    
            bundles.Add(new StyleBundle("~/Content/css").Include(
                      //"~/Content/bootstrap.css",
                      //"~/Content/site.css",
                      "~/Content/metro-ui/css/metro-bootstrap.css",
                      "~/Content/metro-ui/css/metro-bootstrap-responsive.css",
                      "~/Content/metro-ui/css/iconFont.min.css"));
        }
    

This code should be added to the head section of your _Layout.cshtml file:

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>

    <link href="Content/metro-bootstrap.css" rel="stylesheet" />
    <link href="Content/metro-bootstrap-responsive.css" rel="stylesheet" />

    <script src="Scripts/jquery-1.10.2.js"></script>
    <script src="Scripts/jquery.widget.min.js"></script>
    <script src="Scripts/metro.min.js"></script>

    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Styles.Render("~/Content/metro-ui/css")

</head>

Prior to closing the body tag, make sure to include the following:

   <body class="metro">
      (...)
      @RenderBody()

      @Scripts.Render("~/bundles/jquery")
      @Scripts.Render("~/bundles/metro-ui")
      @Scripts.Render("~/bundles/bootstrap")
      @RenderSection("scripts", required: false)
   </body>
</html>

This is what my segment of the solution explorer looks like:

For instance, in the View for controller: Home, action: Index, I have included a link to view further information:

http://pastebin.com/7UXbWhBQ

The end result is that clicking on the list items (e.g., Base CSS) does not yield any response...

Further documentation can be found here: https://github.com/olton/Metro-UI-CSS/blob/master/docs/navbar.html

What could be causing this issue?

Answer №1

Your website is encountering issues with duplicated scripts and references to non-existent bundles. Specifically, the line of code below:

@Scripts.Render("~/bundles/jquery")

is calling for 3 scripts that are already included in a bundle definition, so it's unnecessary to have them listed in the <head> section.

Furthermore, you also have references to

@Styles.Render("~/Content/metro-ui/css")
and
@Scripts.Render("~/bundles/metro-ui")
, but these bundles aren't present in your BundleConfig.cs file.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it necessary to bring in CSS for the following page?

Should CSS be imported and used across multiple pages in a web application? Is the page structure outlined below considered acceptable, or is there a standard practice to follow? /pages /home index.js index.module.css /cart ...

The size of jVectorMap is displayed too diminutive

Why isn't my jVectorMap adjusting to the new height I've specified for the containing div? It only displays at the default height of 54px. Within a document.ready function in my scripts.js file, I have the following code: $('#team-map-usa& ...

Can you explain the difference between DbEntityValidationResult and ValidationResult?

Is there a correlation between the classes System.Data.Entity.Validation.DbEntityValidationResult and System.ComponentModel.DataAnnotations.ValidationResult? The interface IValidatableObject deals with ValidationResult objects for validating an object usi ...

Leveraging the sibling combinator for altering the class of a sibling SVG element with the assistance of Material

I have created an SVG picture that I am trying to animate. Behind the elements I want to animate on mouse hover, I have added transparent rectangles. The hover effect works well on these elements as the cursor changes to pointer. However, when I attempt t ...

Adding a C# variable to a URL in a Razor view using jQuery

My Razor page looks like this: @{ ViewData["Title"] = "mypage"; string ApiAddress = "https://localhost:8114/api/"; } <div> ... </div> @section Scripts{ <script> functio ...

Switching between C# TabControl TabPages

Is there a way to programmatically switch the active tabpage in my tabcontrol? ...

Why aren't CSS variables "calculating" the color?

Can anyone help me understand why I am having trouble assigning block-level CSS variables using values from SASS? Specifically, the line color: hsl(3, 75%, var(--main-color-l)); is not producing any output. My setup involves a static site generator with ...

Just starting out with CSS and coding. Setting up radio buttons and divs for a simple beginner's gallery

One challenge that perplexes me is how to reposition the concealed divs below the radio buttons with labels. Check out my HTML here View my CSS code here /*color palette: abls [lightest to darkest] #eeeeee #eaffc4 #b6c399 ...

Strange Phenomenon: Website Appears Enlarged When Accessed through Server

Similar Question: Why does my website appear smaller on a live server than when deployed locally? After reviewing the answer to the similar question linked above, I still found myself facing the same issue with no resolution. My problem is that the webpa ...

Setting up Scss and purgeCss configuration in Next.js custom postCSS configuration: A step-by-step guide

My current project is using Scss in combination with Bootstrap for design. I have implemented purgeCss to remove unused Css, and customized my postcss.config.js file as follows: module.exports = { plugins: [ "postcss-flexbugs-fixes", [ " ...

Arrange and overlay PNG images within a Bootstrap container using position:absolute

I've been attempting to align and stack some images within a bootstrap grid, but I'm having some trouble. Instead of aligning within the grid, the images seem to align to the window instead. I've been using position:absolute, which I found ...

When converting the .html file to a .php file, the CSS file fails to be linked correctly

The issue I'm facing seems to be specific to the index.html file. The CSS that functions properly with an html extension suddenly stops working when the extension is changed to php. Upon inspecting the reference link in both cases, I noticed that when ...

What is the process for adjusting positioning in bootstrap?

After spending countless hours attempting to create a responsive webpage using the bootstrap grid system, I have hit a dead end. Here is the code I have been working with: <div class="row"> <div class="col-md-2" align=&quo ...

Can the CSS color of struts2-jquery-grid-tags be modified?

Is there a way to customize the CSS style of my Struts2 jQuery grid tags? I'm having trouble adjusting the font size of the header layer. Can someone please advise on how to change the style, color, and other formatting of the grid similar to regular ...

Is Django_compressor concealing the CSS code?

I have implemented django_compressor in my project. This is how I set it up in my template : {% load compress %} {% compress css %} <link rel="stylesheet" href="/media/css/master.css" type="text/css" charset="utf-8"> {% endcompress %} In my setti ...

Embracing right-to-left (RTL) languages

I am looking to create a website that can support both left-to-right (LTR) and right-to-left (RTL) languages seamlessly. My goal is to have the text direction switch automatically to RTL if the content is in an RTL language. Additionally, I want the input ...

Utilize the CSS exclusively for the specific element

nav ul { } nav ul li { margin-left: 7px; } nav.ul li a, a:link, a:visited { float: left; padding: 7px; margin-left: 15px; color: #ffffff; text-decoration: none; font-weight: bold; } nav ul li a:hover { } The styling above is ...

Exploring the object tag box model and its properties for width and padding in Firefox version 6

Hey there, I've been puzzled by the fact that my Firefox browser seems to be using a different box model for my video embeds compared to Chrome. Even though the same CSS rules are being applied, if the object tag includes attributes like data="whateve ...

Utilizing Modal Windows in Asp.net MVC 4

I have a view called index that contains two buttons. When I click on one of the buttons, I want to display a modal form for the user to input their information, but it doesn't seem to be working. The code for my button is: <button type="button" ...

Exploring the Power of SAP UI5 Integration with ASP: Harnessing the Potential of

Can anyone provide guidance on how to integrate an SAP UI5 control with the asp:repeater control? I'm facing an issue where a button only appears in the first iteration of the repeater and not in subsequent iterations. <asp:Repeater ID="NewsFeedID ...