win*_*sql 8 webgrid razor asp.net-mvc-3
我正在使用VB.NET中的MVC3开发一个Web应用程序.
我在使用以下操作链接在webgrid上设置列时遇到困难
编辑| 细节| 删除
@*@Html.ActionLink("Edit", "Edit", New With {.id = currentItem.PrimaryKey}) |
@Html.ActionLink("Details", "Details", New With {.id = currentItem.PrimaryKey}) |
@Html.ActionLink("Delete", "Delete", New With {.id = currentItem.PrimaryKey})*@
我试过使用下面的语法,但我得到一个错误,其中未声明项目.
grid.Column(header:="",format:=(item)=> item.GetSelectLink("Custom Text"))
如何引用webgrid中的当前行或项目以使其工作?
任何帮助非常感谢.
问候
詹姆士
Ahm*_*mad 11
grid.Column(
columnName:"PrimaryKey", 
header:"Actions",      
format: (item) => 
{
   var links = Html.ActionLink("Edit", "Edit", new {id = item.PrimaryKey}) + " | " +
               Html.ActionLink("Details","Details", new { id = item.PrimaryKey}) +" | "+
               Html.ActionLink("Delete","Delete", new { id = item.PrimaryKey});
   return Html.Raw(links);
}),
呈现以下HTML(格式化为易读性)
<td>
  <a href="/Home/Edit/5">Edit</a> | 
  <a href="/Home/Details/5">Details</a> | 
  <a href="/Home/Delete/5">Delete</a>
</td>
| 归档时间: | 
 | 
| 查看次数: | 8003 次 | 
| 最近记录: |