We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Join columns in Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

96761 Oct 4,2010 11:30 AM Oct 11,2010 01:31 AM ASP.NET MVC (Classic) 1
loading
Tags: Grid
Jose L. Garcia
Asked On October 4, 2010 11:30 AM

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



Krishnaraj D [Syncfusion]
Replied On October 11, 2010 01:31 AM


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




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;