0
Html.ActionLink("Edit", "ActionResult", new { CustomerId= DataBinder.Eval(c.DataItem, "CustomerId") }, new { target = "_blank" })
我怎樣才能讓html.actionlink作爲圖像(圖像集合)設置圖像爲Html ActionLink的
任何幫助將大大apreciated。
Html.ActionLink("Edit", "ActionResult", new { CustomerId= DataBinder.Eval(c.DataItem, "CustomerId") }, new { target = "_blank" })
我怎樣才能讓html.actionlink作爲圖像(圖像集合)設置圖像爲Html ActionLink的
任何幫助將大大apreciated。
根據定義,ActionLink
幾乎是一個鏈接。您打電話的Html.ActionLink
方法甚至接受鏈接的文本作爲其第一個參數,因此您可以期望它是文本鏈接。
但隨着略更多的手動HTML,您可以使用同一個目標URL圍繞img
標籤的a
標籤。只需use Url.Action
而不是Html.ActionLink
。也許是這樣的:
<a href="@Url.Action("ActionName", "ControllerName", new { CustomerId= DataBinder.Eval(c.DataItem, "CustomerId") })" target="_blank">
<img src="yourImage.png" alt="Image Text" />
</a>
我使用DevExpress的,所以我需要的ActionLink – user2927086
@ user2927086:我不熟悉的DevExpress。 (你在你的問題中也沒有提到它)。但是,如果它不允許你自定義你的輸出,它似乎是一個有限的工具集。無論如何,你至少要在你的問題中詳細說明。爲DevExpress添加標籤,包含更完整的代碼示例,並解釋爲什麼您需要使用Html.ActionLink。 (其中,我懷疑你實際上並不需要*)。 – David