简体   繁体   中英

grid mvc add button type and class to column

I need to get column data for Home column. I'm trying to add button and class to the column as below and it is not working

Main View:

@Html.Grid(Model).Columns(columns =>
{
    columns.Add(c => c.Home).Titled("Home").Sanitized(false).Encoded(false)
            .RenderValueAs(data => "<button type='button' class="btn - link ind redText" </button>");
    columns.Add(c => c.UserName).Titled("UserName").SetWidth(20);
    columns.Add(c => c.Address).Titled("Address").SetWidth(20);
    columns.Add(c => c.Phone).Titled("Phone").SetWidth(20);
}).WithPaging(8);

Please let me know how to add class and button type to column in grid.mvc

I found a solution:

columns.Add().Encoded(false).Sanitized(false).Titled("HOME").RenderValueAs(c => @); -->This will add required image to a column.

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