Why is this column not showing the links when I can see that the dictionary contains the keys and values. It looks like the index "item.Name" is not resolving. It was working fine before when I didn't have the permission if blocks. The plain format: @<text>@Html.ActionLink("Details", "Details", new {id = item.Id})</text>
works.
grid.Column(header: "Actions", format: @<text>
@if(Model.Permissions.ContainsKey(item.Name))
{
var permissions = Model.Permissions[item.Name];
if (permissions.Contains("Read"))
{
@Html.ActionLink("Details", "Details", new {id = item.Id})
}
if (permissions.Contains("Update"))
{
@Html.ActionLink("Edit", "Edit", new {id = item.Id})
}
}</text>)
It actually works as intended. I had a typo in the string being searched in the list here permissions.Contains("Update")
and permissions.Contains("Read")
. "Update" and "Read" are something in the form "Read_x" and "Update_x". I should know not to use string literals even if I planned to refactor them later.