Reputation: 291
@if (item.hasTypes.Value == true) {
Html.ActionLink(item.marketGroupName, "Index", new { id = item.marketGroupID });
}
I have this so that if the hasTypes is true, it will create an actionlink. But the above code does not work. It is showing empty in those columns.
Upvotes: 10
Views: 10159
Reputation: 1038780
I think you forgot an @
which is used to output:
@if (item.hasTypes.Value) {
@Html.ActionLink(item.marketGroupName, "Index", new { id = item.marketGroupID });
}
Upvotes: 21
Reputation: 53183
You need to actually render the link to the output. Your current code produces a link but doesn't actually do anything with it. Notice the extra @
below:
@if (item.hasTypes.Value == true) {
@Html.ActionLink(item.marketGroupName, "Index", new { id = item.marketGroupID });
}
Upvotes: 3