简体   繁体   English

如何防止导航栏变成下拉菜单?

[英]How do I prevent my navbar from turning into a dropdown?

I created a new project, and chose the MVC model, and most pleasingly, I was greeted by this auto-generated site by Microsoft 我创建了一个新项目,并选择了MVC模型,最令人高兴的是,Microsoft对此自动生成的网站表示了欢迎。

当它起作用

I made a simple change in the code, trying to render an html header (a simple greeting), including the text value from a custom-made object, like so: 我对代码进行了简单的更改,尝试呈现html标头(简单的问候),包括来自定制对象的文本值,如下所示:

Making the property in the HomeController 在HomeController中制作属性 视包

public class HomeController : Controller
{
    public ActionResult Index()
    {
        return View();
    }

    public ActionResult About()
    {
        ViewBag.Message = "Your application description page.";
        ViewBag.NewProperty = "This is my first app!";
        return View();
    }

    public ActionResult Contact()
    {
        ViewBag.Message = "Your contact page.";
        return View();
    }
}

Accessing the same property from my View 从我的视图访问同一属性 Viewbag.NewProperty

@{
    ViewBag.Title = "About";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<h1>@ViewBag.NewProperty</h1>

<p>Use this area to provide additional information.</p>

But as you can probably imagine, I was instead bewildered by what was then presented before me as I re-launched my web application 但正如您可能想像的那样,当我重新启动Web应用程序时,我对当时面前呈现的内容感到困惑

这个错误

I had of course been expecting to see my previous view, but with my new H1 property added unto the page. 我当然希望看到以前的视图,但是在页面上添加了我的新H1属性。 Instead I was baffled at how I managed to be so clumsy, as to fail such a simple task. 相反,我对自己如此笨拙以至于无法完成如此简单的任务感到困惑。

Therefore, I sincerely plead, that the professional community here on Stackoverflow can help shed some light on what is going wrong. 因此,我衷心恳求,Stackoverflow上的专业人士可以帮助您弄清问题所在。

I haven't changed the code in any shape or form besides what I have now shared with you. 除了现在与您共享的内容外,我没有更改任何形式的代码。

It's a BootStrap problem. 这是BootStrap问题。 Go to your Nuget manager and uninstall your bootstrap, then reinstall BootStrap version 3.3.7. 转到您的Nuget管理器并卸载引导程序,然后重新安装BootStrap版本3.3.7。 That should do the trick. 这应该够了吧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM