I am trying to format a WebGrid column so I can concatenate two pieces of data together (first and last name). Here is what I'm trying, but I will admit I don't think I fully understand how to use the data (besides the basic scenarios) in WebGrid. (To the column name, the Teacher object is being passed to my view, but to actually get the teacher's name, I have to get that information from the linked user object since users can play multiple roles.)
grid.Column(
columnName: "Teacher.User",
header: "Teacher",
style: "",
canSort: true,
format: (item) =>
{
var text = Html.DisplayTextFor(item => item.LastName) + ", " + Html.DisplayTextFor(item => item.FirstName);
return Html.Raw(text);
}
)