2012-04-27 89 views
0

我有我想要顯示的圖像而不是文字網頁格「刪除」MVC 3網格圖像

,而不是這個「Html.ActionLink(」刪除「」我希望把圖像

我怎麼能做到這一點

這是我的代碼:?

enter code here 

       @{ var grid = new WebGrid(source: Model.PartImageSearchResult, rowsPerPage: 2, canPage: true, defaultSort: 
         "PartImageSearchResult.PartImageName", canSort: true, ajaxUpdateContainerId: "ImagesListGrid");} 

        @grid.GetHtml(
        mode: WebGridPagerModes.All, 
        numericLinksCount: 5, 
        firstText: "First", 
        lastText: "Last", 
        previousText: "Previous", 
        nextText: "Next", 
        tableStyle: "webgrid", 
        headerStyle: "webgrid-header", 
        rowStyle: "webgrid-row-style", 
        footerStyle: "webgrid-footer", 
        alternatingRowStyle: "webgrid-selected-row", 
        htmlAttributes: new { id = "PartFilesUploadID" }, 
        columns: grid.Columns(



        //grid.Column(style: "PartImagesDelete", format: (item) => Html.ImageLink("~/Content/images/btn_delete_sm.png", "DeletePartImages", new { id = item.PartFilesUploadID }, new { onclick = "return confirm('Are you sure you wish to delete this article?');" })), 


        grid.Column(style: "PartImagesDelete", format: (item) => Html.ActionLink("Delete", "DeletePartImages", new { id = item.PartFilesUploadID }, new { onclick = "return confirm('Are you sure you wish to delete this article?');" })), 
        grid.Column(header: "Images", style: "PartImages", format: @<text><img src="@Url.Content("~/Uploads/Parts/" + item.PartImageName)" alt="" style="width:100px;height:50px;" /></text>), 
        grid.Column(header: "Files Name", format: @<text>@((item.PartImageName as String))</text>))) 

回答

0

我想看看這裏Action Image MVC3 Razor

您的行爲是否在網格中無關緊要。如有必要,您可以在採用特定模型的自定義操作鏈接上打一個部分。

+0

尼克謝謝你回答我的問題。 – user1361209 2012-04-27 15:07:12

+0

我想做這樣的事情: – user1361209 2012-04-27 15:07:26

+0

grid.Column(style:「PartImagesDelete」,format:(item)=> Html.Action(「〜/ Content/images/btn_delete_sm.png」,「DeletePartImages」,new {ImageID = item.PartFilesUploadID},new {onclick =「return confirm('您確定要刪除這篇文章?');」})), – user1361209 2012-04-27 15:07:33

0
grid.Column("", header: "Acciones", style:"width: 5%", 
            format: @<text> 
               <div class="btn-group"> 
                <a class="btn btn-small" href='@Url.Action("Editar", "Ruta", new { id = item.RutaID })'><i class="icon-pencil"></i></a> 
                <a class="btn btn-small" href='@Url.Action("Detalle", "Ruta", new { id = item.RutaID })'><i class="icon-eye-open"></i></a> 
                <a class="btn btn-small" href='@Url.Action("Borrar", "Ruta", new { id = item.RutaID })'><i class="icon-trash"></i></a>                    
               </div> 
              </text>) 
+0

如果您能解釋爲什麼這是正確的答案以及它如何解決OP問題,那更好。 – 2015-04-05 21:02:01