Why doesn't Bootstrap have access to the tab view obtained on _Layout.cshtml when it is clicked?

Currently, I am working on an MVC-5 project using Bootstrap and have all my links in _Layout.cshtml. I have a drop-down tabs feature like this: http://prntscr.com/76jfba (implemented using Bootstrap, visible on Visual Studio project launch). In my _Layout.cshtml, I have the renderbody() which renders all the UI elements.

My Goal:

When clicking on the "Real Time" tab, I want to display a dropdown list that, upon further clicking on "Tabular", will replace the current view just below the tabs with a new view.

What I Have Tried:

(1) In the HomeController, I created the following:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace testLayt.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult tabularshared()
        {
            return View();
        }
    }
}

(2) Then, I created a view where I set the Layout path as follows:

@{
    ViewBag.Title = "shekharTabularshared";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>tabularshared</h2>

However, the result shows misalignment of tabs as seen here: http://prntscr.com/76jiag. It seems like there might be an issue with accessing Bootstrap or something wrong in my approach?

I would greatly appreciate guidance on how to properly display the tabular.cshtml view just below the tabs in the first link (keeping the tab common across all views obtained).

Edit: _Layout.cshtml

 <!-- HTML code for layout goes here --> 

and Index.cshtml is:

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
    }

<h2>shekhar Index</h2>

I also noticed that upon clicking "Tabular" and inspecting elements, I do not see the line

<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" />
appearing. This has been perplexing me for the last 3 days. Any assistance would be highly appreciated.

If you wish to examine my entire project and offer your insights, please check it out here:

Answer №1

It doesn't matter how you choose to display your user interface.

  1. Ensure there are no issues in your developer console (you may have misconfigured your bundles for bootstrap scripts).
  2. Keep only one link to the bootstrap CSS:

    href="~/Content/bootstrap.min.css"

  3. Check in the developer console that all scripts and styles are loading correctly on the page.

    If everything seems fine but your code still isn't functioning - provide a full screenshot of your webpage in the browser and notify me in the comments section.

You have omitted the '~' symbols in your bootstrap CSS links.

<script src="bootstrap/js/jquery-ui.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>

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

Display text with a hover effect

When I hover over an image, I want to display some text. I managed to make it work, but the text was expanding the size of the card. To solve this issue, I added a display none to the text class. I can't include all the code here, so here's a sn ...

Adjusting the size of an image and its accompanying span within the container div

I have a fixed width and height div where I want to include an image with a caption (using img and figurecaption) without exceeding the parent's dimensions. Here is what I attempted: ` parent-> height: 100px; width: 100px; margin: 0; img-> d ...

Executing Multiple Requests Concurrently in Angular 5 using forkJoin Technique

Important Note The issue lies in the backend, not Angular. The requests are correct. In my Angular5 app, I am trying to upload multiple files at once using rxjs forkJoin. I store the requests in an array as shown in the code below. However, after adding ...

AngularJS: accessing siblings by using the ng-click directive

I am currently working on a list (<ul>), which is being used in multiple instances within different ng-repeat iterations on the same page. The initial list items are generated through ng-repeat, with the second to last item containing a span. When t ...

Looking to access HTML elements in React without relying on setTimeout?

When developing a component that requires grabbing DOM elements to calculate heights, I initially resorted to using a setTimeout function to ensure the elements are captured once the page loads. While this solution worked perfectly, I am aware that there ...

Tips for dynamically updating the value of a variable in Vue by importing a JavaScript file

There is a file for an app that imports ymaps.js where YmapsComponent.vue is declared. import '../js/ymaps.js'; import { createApp } from 'vue'; const app = createApp({}); import YmapsComponent from './components/YmapsComponent.vue ...

How can you align elements like a poster board using CSS?

Looking to create a unique box layout inspired by this posterboard design: Currently, my boxes have fixed widths and resizable heights based on their content. However, I'm struggling to get them to stack horizontally like the example above. Any ideas ...

Issue Encountered: Problem with Implementing Google Fonts in WordPress Theme

I am currently facing an issue with a function in my Wordpress theme's functions file that is supposed to add Google Fonts to the theme. However, I keep receiving the following error message: Parse error: syntax error, unexpected '=', expec ...

React state change does not effectively adjust Grid Size

I am facing an issue with adjusting the grid size in my Conway game of life app. Whenever I click on the buttons to change the numCols or numRows, only one of them gets updated in the app. How can I effectively update the state so that the grid changes siz ...

What is the reasoning behind the return type of void for Window.open()?

There is a difference in functionality between javascript and GWT in this scenario: var newWindow = window.open(...) In GWT (specifically version 1.5, not sure about later versions), the equivalent code does not work: Window window = Window.open("", "", ...

differences in opinion between JavaScript code and browser add-ons/extensions

As the owner and developer of an e-commerce website, I find that potential customers often contact us regarding ordering issues. Upon investigation, we consistently discover that the problem is caused by JavaScript errors. We frequently check their browse ...

Searching for a specific element in Vue.js using its unique identifier (ID) can be

I have a new project using Vue. It includes a div that loops through title and data. Inside the div, there is a search filter and content that renders in p tags. The p tags also go through a loop. Take a look at the code below: <div> <div v- ...

Display Discrepancies Between Internet Explorer and Safari in CSS

I'm currently working on designing a CSS menu for a jQuery-based website. The goal is to have a blue gradient displayed for all menu headings, which should change to gray when moused over. However, I've encountered an issue where only the heading ...

The promise is coming back as undefined

I am encountering an issue where the value returned from a promise is coming back as undefined in my template. In the getLabel function, I am receiving a label as a promise and resolving it before returning it to the title in the getMenuItems function. H ...

Tips for creating a script that compiles all SCSS files into CSS within a Vue 3 project

Within my project, there exists a file named index.scss located in the src/assets/styles directory. Adjacent to this file are multiple folders housing SCSS files that are ultimately imported into index.scss. My objective is to devise a script within the pa ...

Determine whether a value within one array is present within an object contained in another array

I am attempting to determine if a value from array1 exists within an object in array2. array1: [2,5,1] array2: [ { value: 1, name: 'Monday', isSelected: false }, { value: 2, name: 'Tuesday', isSelected: false }, { value: 3 ...

The error was thrown at line 800 in the loader.js file of the internal modules

When I ran yarn install in my project folder, I encountered the following error: internal/modules/cjs/loader.js:800 throw err; ^ Error: Cannot find module 'ts-node/register' Require stack: - internal/preload ?[90m at Function.Module._resolveF ...

Troubleshooting problems with AngularJS loading data through ajax

One of the custom widgets in my application relies on Angular functionality. On a particular page, this widget is loaded via ajax. The following content is fetched through ajax and inserted into the DOM: _abc.html: <script type="text/javascript">c ...

Retrieve the Checked Value of a Checkbox Using Ajax Post in MVC

Can anyone provide assistance? This is the code I am working with: Index.cshtml <!DOCTYPE html> <html> <head> <title>jQuery With Example</title> @Scripts.Render("~/bundles/jquery") <script type="text/javascri ...

Expanding the height of a Jquery element while also handling text overflow

I am attempting to make a div's height automatically expand when the text inside it overflows. You can view my code on JSfiddle. While this isn't the exact environment where I need this functionality, the concept remains the same. I just need the ...