Hyperlink in table header is not rendering

354 views Asked by At

I'm trying to put hyperlinks/actionlinks in my table headers, for sorting purposes, but for some reason they won't render.

Any idea why it's not rendering properly? In the code below, you see the first table header is an Actionlink. The header renders is empty. I inspected the element and it indeed appears empty.

code:

@model PagedList.IPagedList<FitnerWebRole.ViewModels.CenterVM>
@using FitnerWebRole.Models
@using IdealDatabase

@{
    ViewBag.Title = "Centers";
}
@using (IdealDb db = new IdealDb(ApiConfig.AppName, ApiConfig.DbServer, ApiConfig.DbUser, ApiConfig.DbPassword))
{
    <div class="container adminContainer event">
        <p>
            @Html.ActionLink("Create New", "Create", null, new { @class = "btn btn-success" })
        </p>
        @Html.PagedListPager(Model, page => Url.Action("Index", new { page }), PagedList.Mvc.PagedListRenderOptions.Minimal)
        <table id="centerTable" class="table">
            <thead>
                <tr>
                    <th>
                        @Html.ActionLink("Name", "Index", new { sortOrder = "name", currentSort = "name" })
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.FirstOrDefault().Address)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.FirstOrDefault().ChainId)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.FirstOrDefault().CityId)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.FirstOrDefault().LangId)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.FirstOrDefault().Lat)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.FirstOrDefault().Lon)
                    </th>
                    <th></th>
                </tr>
            </thead>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.Name)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Address)
                    </td>
                    <td>
                        @Chain.Get(db, item.ChainId).Name
                    </td>
                    <td>
                        @City.Get(db, item.CityId).Description
                    </td>
                    <td>
                        @Language.Get(db, item.LangId).Code
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Lat)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Lon)
                    </td>
                    <td class="tableControls">
                        @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                        @Html.ActionLink("Details", "Details", new { id = item.Id }) |
                        <button id="delete" name="Center" value="@item.Id" class="btn btn-danger delete">Delete</button>
                    </td>
                </tr>
            }

        </table>
        Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
        @Html.PagedListPager(Model, page => Url.Action("Index", new { page }))
    </div>
}
0

There are 0 answers