I am trying to populate a JQGrid with LinQ but am having problems in getting a value from a foreign table.
Scenario: I have a Users table and a Country table. I am returning a List from the data layer and binding it to the grid. The values from the users table populate with no problem. My problem is when trying to link a JQGrid column to a column in the Country table, such as Country Name. If I debug the data returned from the data logic, the Country Name is filled in, but I can't find a way to link a JQGrid column to the 开发者_StackOverflow社区Name column in the Country table. I tried, with no luck, the following:
<trirand:JQGridColumn DataField="Country.Name"/>
<trirand:JQGridColumn DataField="Country_Name"/>
Thanks for your time...
Have you tried using a ViewModel so it is not trying to bind to a navigation property?
something like:
public class UserViewModel
{
public int UserID { get; set; }
public string Username { get; set; }
public string CountryName { get; set; }
}
精彩评论