asp.net-mvcgrid.mvc

merge two cells and display in Grid.Mvc


I am trying to merge two column values and display in grid.mvc . I searched a lot and did not find any solution. So i doubt there is any way to do it.So anyone can tell me is there any way we can merge two columns in grid.mvc ??

@Html.Grid(Model).Columns(columns => { 
     columns.Add(c => c.FirstName).Filterable(true); 
     columns.Add(c => c.LastName).Filterable(true); ); 
}).Sortable(true)

Solution

  • I got the solution by using the following:

    columns.Add().Titled("Customer").RenderValueAs(c => c.FirstName +" "+ c.LastName);