我的观点只显示没有

时间:2017-06-23 15:13:27

标签: asp.net asp.net-mvc razor

我有一个简单的视图。

@model zzzzzz.Models.MyModel

@{
    ViewBag.Title = "Language";
 }
 <h2>Hello World</h2>

 <div class="table-responsive">
    <table>

    </table>
 </div>

控制器很简单

    public ActionResult Language(int id)
    {
        var country = myService.GetCountryById(id);

        var model = new MyModel();
        model.Languages = myService.GetCountry(id);
        return View(model); 
    } 

我在控制器处设置了断点,它确实到达了那里。视图的地址为<a href="/Country/Language/1111">Languages</a>

然而,它只显示什么,不知道为什么。在chrome中的开发人员调试工具中没有发现错误。

那有什么不对?

修改

 public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute("TestSubmitRoute", "Test/Submit",
                        defaults: new {action = "Submit", controller = "Test"});

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }
        );
    }

编辑更多

来自铬源,

        <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Language</title>
        <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />

    <link rel="apple-touch-icon" href="/content/images/ios/logo.png" />
    <link rel="apple-touch-icon" sizes="72x72" href="/content/images/ios/logo.png" />
    <link rel="apple-touch-icon" sizes="114x114" href="/content/images/ios/logo.png" />
    <link rel="apple-touch-icon" sizes="144x144" href="/content/images/ios/logo.png" />
    <link rel="icon" type="image/png" href="/content/images/icon.png?v=2">
        <script src="/Scripts/modernizr-2.5.3.js"></script>

        <link href="/content/css/bootstrap.min.css" rel="stylesheet" />

        <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" />
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&subset=latin,cyrillic-ext,latin-ext' rel='stylesheet' type='text/css' />
            <link id="base-style" href="/content/css/site.css" rel="stylesheet" />



        <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    </head>
    <body>


    <h2>Language</h2>

    <div class="table-responsive">
        <table>

        </table>
    </div>


        <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>

        <script src="/scripts/lib/bootstrap.3.js"></script>
        <script src="/scripts/lib/validate.js"></script>



    <!-- Visual Studio Browser Link -->
    <script type="application/json" id="__browserLink_initializationData">
        {"appName":"Chrome","requestId":"cf995a8a2f4847f5b19de5130cb9a7b0"}
    </script>

    <!-- End Browser Link -->

    </body>
    </html>

1 个答案:

答案 0 :(得分:0)

在site.scss中背景较暗时覆盖视图中的css规则。

<style>
body {
    background: white;
}