Html.ActionLink does not display anything

I have this simple snippet with ActionLink that should display some text as a link, but it does not work.

Here's a snippet of code.

<div id = "Div1">
        <table id = "Table1">
            <% while ((category = SomeNamespace.Helper.GetNextCategory(categoryIndex++)) != null)
               { %>
                <tr>
                    <td class = "catalogCell">
                        <% Html.ActionLink(category.Name, 
                               "DisplayCategory", 
                               "Catalog"); %>
                    </td>
                </tr>
            <% } %>
        </table>
    </div>
+3
source share
2 answers

You need the = sign:

<%= Html.ActionLink(category.Name, 
                    "DisplayCategory", 
                    "Catalog") %>
+2
source

Use the style <%: ... %>and do not forget to delete the half-point (;) at the end of the instruction.

+1
source

Source: https://habr.com/ru/post/1759451/


All Articles