简体   繁体   中英

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. 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 ?

I find the solution :

You have to use the MvcContrib.UI.Grid.ActionSyntax namespace

and it provides you an extension method called "Action".

Here is a simple use :

column.For("PDF").Named("PDF").Action(p => { %> 
<td><img src="../Content/Images/pdf.gif" /></td> <% });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM