1
votes

It is as if the ending tag is not being recognized. This is an asp.net MVC4 application coded in c#. 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. 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

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version: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>
2
The closing tags are </tr>, </td> (note the location of the forward slash)Kevin Le - Khnle

2 Answers

1
votes

Line 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

<tr/>

should be changed to this

</tr>
0
votes

You have missed > of a tag, also <tr/> should be </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>