Last post Mar 05, 2019 08:59 PM by MVCNewbi3v
Mar 05, 2019 06:34 PM|MVCNewbi3v|LINK
I've followed this to great a expandable and collapsible webgrid.
Everything seems to be working great. With the example when I go to sort my main table header. When ever I click them the grid either gets blanked out or the hidden table gets shown. Would someone happen to know why this is the case or have implemented this
The only difference i could see that may affect the grid is i am using the
Mar 05, 2019 08:49 PM|MVCNewbi3v|LINK
Updated: I figured out the issue. I was trying to sort on a Navigation Property and Webgrid was throwing an error. I'm not sure how to resolve this.
My Model includes the Navigation to the One to Many join table, let's call it "Book"
model.MyModel = db.MyModels
.Include(x => x.Book)
In my grid i have column:
grid.Column("Book.Name", "Status", style: ""),
It renders the Book name properly on the webgrid when i am displaying it. but when i try to sort on the Book Name it throws an error.
Mar 05, 2019 08:59 PM|MVCNewbi3v|LINK
Figured it out. I had to use
grid.Column(columnName: "BookId", header: "Book Name", format: (item) => item.Book.Name),