1
@Ajax.ActionLink("&nbsp","Delete", "FinancialIntermediary", 
                 new { id = item.FinancialIntermediaryID }, 
                 new AjaxOptions { HttpMethod = "GET", 
                                   OnSuccess = "DeleteSuccessFI", 
                                   Confirm = "are you sure to perform the deletion." },
                 new { @class="classname" })  

css 文件是

.classname
 {
    background-image:url('../../Images/delete.png');
 }

我使用上面的代码来设置要删除的背景图像。

通过这样做,我无法避免文本。它是这样的 在此处输入图像描述

我只想要那个地方的图片。请帮忙

4

1 回答 1

2

而不是 只使用一个空格:

@Ajax.ActionLink(" ","Delete", "FinancialIntermediary", new { id = item.FinancialIntermediaryID }, new AjaxOptions { HttpMethod = "GET", OnSuccess = "DeleteSuccessFI", Confirm = "are you sure to perform the deletion." },new { @class="classname" })  

您还需要为元素腾出一些空间,以便显示背景图像:

.classname
        {
            background-image:url('../../Images/delete.png');
            display: inline-block;
            width: 20px; /* adjust as necessary */
            height: 10px;/* adjust as necessary */ 
        }
于 2013-05-19T15:12:19.980 回答