Я использую MVC - Razor - я новичок в этом, и у меня возникли некоторые проблемы при создании ActionLink в сетке ...
@grid.GetHtml(
//Some grid setting stuff here
columns: grid.Columns(
grid.Column(null, null,
@<div class="vehicleResult">
@{
var text = string.Format("{0} {1} {2}", item.Value.GetPropertyValue("Manufacturer"), item.Value.GetPropertyValue("Shell Shape"), item.Value.GetPropertyValue("Model"));
@Html.ActionLink(text, MVC.Search.ActionNames.VehicleView, MVC.Search.Name, new { Id = item.Id }, new { });
}
<a>@string.Format("{0} {1} {2}", item.Value.GetPropertyValue("Manufacturer"), item.Value.GetPropertyValue("Shell Shape"), item.Value.GetPropertyValue("Model"))</a>
)))
Тег в конце работает нормально, но я хочу текст из тега , т.е.
@string.Format("{0} {1} {2}", item.Value.GetPropertyValue("Manufacturer"), item.Value.GetPropertyValue("Shell Shape"), item.Value.GetPropertyValue("Model"))
отправлено на ActionLink (бит выше).
Также, если я сделаю ...
var text = "blah";
@Html.ActionLink(text, MVC.Search.ActionNames.VehicleView, MVC.Search.Name, new { Id = item.Id }, new { });
тогда это нормально - просто когда они вместе, это не работает ... ошибка, которую я получаю ...
System.Web.Mvc.HtmlHelper<GIT.RetailWebsite.App.ViewModels.VehicleSearchModel>
has no applicable method named 'ActionLink' but appears to have an extension
method by that name. Extension methods cannot be dynamically dispatched.
Consider casting the dynamic arguments or calling the extension method
without the extension method syntax.
d:\TFSProjects\Retail Website\Main\src\Retail Website\GIT.RetailWebsite.App\Views\Search\_grsResultsGrid.cshtml 31 GIT.RetailWebsite.App
Может кто-нибудь помочь, пожалуйста?