简体   繁体   English

关闭标签的ASP.NET解析器错误

[英]ASP.NET Parser Error on closing tags

It is as if the ending tag is not being recognized. 好像没有识别结束标签。 This is an asp.net MVC4 application coded in c#. 这是用c#编码的asp.net MVC4应用程序。 I keep getting this Parsing Error. 我不断收到此解析错误。

Server Error in '/' Application. “ /”应用程序中的服务器错误。 Parser Error Description: An error occurred during the parsing of a resource required to service this request. 解析器错误说明:解析服务此请求所需的资源期间发生错误。 Please review the following specific parse error details and modify your source file appropriately. 请查看以下特定的解析错误详细信息,并适当地修改您的源文件。

Parser Error Message: The "tr" element was not closed. 解析器错误消息:“ tr”元素未关闭。 All elements must be either self-closing or have a matching end tag. 所有元素都必须是自闭合的或具有匹配的结束标签。

Source Error: 源错误:

Line 24:         { 
Line 25:         
Line 26:        <tr>
Line 27:             <td><a href="/Home/Details/@cr.productID"</a><td/>
Line 28:             <td>@cr.productCodes</td>

Source File: /Views/Home/List.cshtml Line: 26 源文件:/Views/Home/List.cshtml行:26

Version Information: Microsoft .NET Framework Version:4.0.30319; 版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET Version:4.0.30319.18449 ASP.NET版本:4.0.30319.18449

Here is the code that I am Using. 这是我正在使用的代码。

@model pearlssportsshopquickalystmvc.bc.Products[]

@{
ViewBag.Title = "List";
}

<h2>List</h2>

<table>
    <thead>
        <tr>
            <th>productID</th>
            <th>productCode</th>
            <th>productName</th>
            <th>smallImage</th>
            <th>largeImage</th>
        </tr>

    </thead>

    <tbody>
        @foreach (Products cr in Model)
        { 

       <tr>
            <td><a href="/Home/Details/@cr.productID"</a><td/>
            <td>@cr.productCodes</td>
            <td>@cr.productName</td>
            <td>@cr.smallImage</td>
            <td>@cr.largeImage</td>
       <tr/>

        }

        </tbody>



</table>

Line 27 27号线

<td><a href="/Home/Details/@cr.productID"</a><td/>

should be changed to this 应该更改为此

<td><a href="/Home/Details/@cr.productID"></a></td>

and line 32 和第32行

<tr/>

should be changed to this 应该更改为此

</tr>

You have missed > of a tag, also <tr/> should be </tr> 您错过a标签的><tr/>应该是</tr>

Change 更改

<a href="/Home/Details/@cr.productID"</a>

                                    ^ > closing angle bracket of anchor tag missing here

To

<a href="/Home/Details/@cr.productID"></a>

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

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