MVC视图不会显示 [英] MVC view will not display

查看:194
本文介绍了MVC视图不会显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


'/'应用程序中的服务器错误。



编译错误


说明:在编译服务此请求所需的资源期间发生错误。请查看以下特定错误详细信息并相应地修改源代码。



编译器错误消息: CS1003:语法错误,'>'预期为¥b $ b

来源错误:










 Line 27:
第28行:
第29行:公共类_Page_Views_Shared_test_cshtml:System.Web.Mvc.WebViewPage< ValueAdded_MVC3.Models.Book;> {
第30行:
第31行:#line hidden





源文件: c:\ Windows \ Microsoft \ Framework\v4.0.30319\Temporary ASP.NET Files\root\eff01b6f\6539d06d\App_Web_test.cshtml.639c3968.6b2ocubl.0.cs  
29


************** ************************************************** *************


当我做"http:// localhost:49822 / demo / test"时,会出现上述情况。在Firefox中


************************************* ****************************************


views \shared \Test.cshtml:


@model ValueAdded_MVC3.Models.Book;

     ;&NBSP;&NBSP;  

@ {

    Layout = null;

}



<!DOCTYPE html>



< html>

< head>

    < title>测试< / title>

< / head>

< body>

    < fieldset>

        < legend> Book< / legend>



        < div class =" display-label"> BookName< / div>

        < div class =" display-field">

            @ Html.DisplayFor(model => model.BookName)

        < / div>



        < div class =" display-label"> AuthorName< / div>

        < div class =" display-field">

            @ Html.DisplayFor(model => model.AuthorName)

        < / div>



        < div class =" display-label"> ISBN< / div>

        < div class =" display-field">

            @ Html.DisplayFor(model => model.ISBN)

        < / div>

    < / fieldset>

    < p>

        @ Html.ActionLink(" Edit"," Edit",new {id = Model.ID})|

        @ Html.ActionLink(" Back to List"," Index")

    < / p>

< / body>

< / html>


******** ************************************************** ********************************


Models \Book .cs:


使用System;

使用System.Collections.Generic;

使用System.Linq;

使用System.Web;
$


命名空间ValueAdded_MVC3.Models

{

  ;&NBSP;&NBSP;公共课程预订

    {

        public int ID {get;组; }
        public string BookName {get;组; }
        public string AuthorName {get;组; }
       公共字符串ISBN {get;组; }
    }
}


***************************** ************************************************** ***********


我缺少什么?



************************************* ************************************************** ***







解决方案

http://forums.asp.net/1146的.aspx / 1?MVC

Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1003: Syntax error, '>' expected

Source Error:

Line 27:     
Line 28:     
Line 29:     public class _Page_Views_Shared_test_cshtml : System.Web.Mvc.WebViewPage<ValueAdded_MVC3.Models.Book;> {
Line 30:         
Line 31: #line hidden


Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eff01b6f\6539d06d\App_Web_test.cshtml.639c3968.6b2ocubl.0.cs    Line: 29

*****************************************************************************

Above occurs when I do "http://localhost:49822/demo/test" in firefox

*****************************************************************************

views\shared\Test.cshtml:

@model ValueAdded_MVC3.Models.Book;
       
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>Test</title>
</head>
<body>
    <fieldset>
        <legend>Book</legend>

        <div class="display-label">BookName</div>
        <div class="display-field">
            @Html.DisplayFor(model => model.BookName)
        </div>

        <div class="display-label">AuthorName</div>
        <div class="display-field">
            @Html.DisplayFor(model => model.AuthorName)
        </div>

        <div class="display-label">ISBN</div>
        <div class="display-field">
            @Html.DisplayFor(model => model.ISBN)
        </div>
    </fieldset>
    <p>
        @Html.ActionLink("Edit", "Edit", new {id=Model.ID}) |
        @Html.ActionLink("Back to List", "Index")
    </p>
</body>
</html>

******************************************************************************************

Models\Book.cs:

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

namespace ValueAdded_MVC3.Models
{
    public class Book
    {
        public int ID { get; set; }
        public string BookName { get; set; }
        public string AuthorName { get; set; }
        public string ISBN { get; set; }
    }
}

******************************************************************************************

What am I missing?

******************************************************************************************

解决方案

http://forums.asp.net/1146.aspx/1?MVC


这篇关于MVC视图不会显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆