Home Why I get error when I try to generate ActionLink?

# Why I get error when I try to generate ActionLink?

Michael
1#
Michael Published in 2017-11-13 12:43:18Z
 I have this HtmlHelper: @foreach (var item in Model) {
}  On this row, @Html.ActionLink(modelItem => item.LayoutID, "someAction");  i get this error: CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type  Why do I get the above error ? The LayoutID is of string type. EDIT Improved Formatting
Shyju
2#
 The first parameter of ActionLink method has to be a string which will appear as the anchor tag text. You are trying to pass a lamda expression. @foreach(var item in Model) {
} 
 you can not use modelitem as parameter in actionlink.actionlink must have string value as parameter try below code:  @Html.ActionLink(item.LayoutID, "someAction")  or i will suggest you to direct write down string  @Html.ActionLink("View Report", "someAction")