-1

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

Swas
  • 1
  • 1
  • Sounds like you want to show a partial view when you click a button? If that is the case, you need to do that client side like [this](https://stackoverflow.com/questions/29142422/rendering-partial-view-on-button-click-in-asp-net-mvc) – Steve Greene Jul 01 '19 at 20:08
  • I'd give this a shot: https://stackoverflow.com/questions/15148103/mvc-4-how-do-i-pass-model-data-to-a-partial-view With a shared model you can "pass" or reference data back and forth between the views. – Dortimer Jul 01 '19 at 19:51
  • I don't have problem calling partial view from main view. I want to know if there is a syntax to call partial view which populates as column data. – Swas Jul 01 '19 at 20:10
  • That line was just how to share the model from your main view to the partial view. I took it out since it doesn't show the big picture. But I'd try that link. If you need to handle data differently depending on a different view, you'll want to share the model across the main view and the partial. – Dortimer Jul 01 '19 at 20:29
  • As there was a confusion with my question, edited it and updated code as well. – Swas Jul 02 '19 at 02:32

1 Answers1

-1

I found a solution:

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

Swas
  • 1
  • 1