Cannot convert lambda expression to type 'string' because it is not a delegate type
Posted
by RememberME
on Stack Overflow
See other posts from Stack Overflow
or by RememberME
Published on 2010-06-01T21:40:54Z
Indexed on
2010/06/01
21:53 UTC
Read the original article
Hit count: 1384
I have the following code written by another developer on 2 pages of my site. This used to work just fine, but now is giving the error "Cannot convert lambda expression to type 'string' because it is not a delegate type" on the Delete line with Ajax.ThemeRollerActionLink
.
I don't go into this section of the site often, and we recently upgraded from MVC 1.0 to 2.0. I'm guessing that's probably when it stopped working. I've looked up this error and the recommended fix seems to be add using System.Linq
However, the page already has <%@ Import Namespace="System.Linq" %>
<%
Html.Grid(Model).Columns(col =>
{
col.For(c => "<a href='" + Url.Action("Edit", new { userName = c }) + "' class=\"fg-button fg-button-icon-solo ui-state-default ui-corner-all\"><span class=\"ui-icon ui-icon-pencil\"></span></a>").Named("Edit").DoNotEncode();
col.For(c => Ajax.ThemeRollerActionLink("fg-button fg-button-icon-solo ui-state-default ui-corner-all", "ui-icon ui-icon-close", "Delete", new { userName = c }, new AjaxOptions { Confirm = "Delete User?", HttpMethod = "Delete", InsertionMode = InsertionMode.Replace, UpdateTargetId = "gridcontainer", OnSuccess = "successDeleteAssignment", OnFailure = "failureDeleteAssignment" })).Named("Delete").DoNotEncode();
col.For(c => c).Named("User");
}).Attributes(id => "userlist").Render();
%>
© Stack Overflow or respective owner