1
我使用MVC中 - 剃鬚刀 - 我是很新,它和我有一點麻煩產生一個網格內的ActionLink的...MVC剃刀 - 用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
任何人都可以協助嗎?