开发者

Using JQGrid with LinQ

开发者 https://www.devze.com 2023-03-15 19:19 出处:网络
I am trying to populate a JQGrid with LinQ but amhaving problems in getting a value from a foreign table.

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; }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号