[英]How to add a custom column to a MvcContrib Grid?
I don't find a method to add a custom column in a MvcContrib Grid. 我找不到在MvcContrib网格中添加自定义列的方法。 With the old version you could do :
使用旧版本,您可以执行以下操作:
column.For("Edit").Do(p => { %>
<td>
<a href="/People/Edit/<%= p.Id %>">Edit</a>
</td>
%>});
But with the latest version, the Do() method disappears... So now which method use ? 但是在最新版本中,Do()方法消失了……那么现在使用哪种方法呢?
I find the solution : 我找到解决方案:
You have to use the MvcContrib.UI.Grid.ActionSyntax namespace 您必须使用MvcContrib.UI.Grid.ActionSyntax命名空间
and it provides you an extension method called "Action". 它为您提供了一个名为“ Action”的扩展方法。
Here is a simple use : 这是一个简单的用法:
column.For("PDF").Named("PDF").Action(p => { %>
<td><img src="../Content/Images/pdf.gif" /></td> <% });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.