Join columns in Grid

Hello,

I've a dude regarding how to add a column from another table to mvc grid.

I've a class CustomerRepository with this method:

// Retrieve all Customers
public IQueryable GetAllCustomers()
{
var customers = from cust in entities.Customers
join grp in entities.Groups
on cust.GroupId
equals grp.GroupId
select cust;

return customers;
}

I want to show in the customers grid the group Name but I'm unable to do it. When I add a new column in customers grid with:

column.Add(c => c.Group.Name).HeaderText("Group");

always I receive the next error:

Object reference not set to an instance of an object.

Any idea about how to achieve this?
Regards
Jose



1 Reply

KD Krishnaraj D Syncfusion Team October 11, 2010 05:31 AM UTC


Hi Jose,

Thanks for your interest in Syncfusion Products.

Currently, we don’t have support for displaying the grouped column. Our Mvc grid doesn’t accept the grouped column as a data source. By enabling the grouping option you can get the grouped column data.

Refer the below code snippets.

<%=Html.Grid("Grid1")
.Datasource(Model)
.EnableGrouping()
})%>

Please let us know if you have any other queries.

Regards,
Krishnaraj D




Loader.
Up arrow icon