Foriegn Key

Dec 16, 2012 at 11:49 AM

Hi,

Suppose I have the following class models

public class CityViewModel
    {
        public long Id { get; set; }
        public string Name { get; set; }
        public CountryViewModel Country { get; set; }
    }

public class CountryViewModel
    {
        public long Id { get; set; }
        public string Name { get; set; }
    }

Is there a way to create a grid on the CityViewModel in such a way that the following columns are displayed:


CityViewModel.Id
CityViewModel.Name
CityViewModel.Country.Name


Thanks

 

 

 

 

 

 

 

 

 

 

 

 

 

Coordinator
Dec 16, 2012 at 6:38 PM

Hi,

The strongly typed helper is not able to generate jqGrid initialization script for such scenario (complex properties are skipped by defulat) - you would have to alter CityViewModel be adding needed property.

As an alternative you can write the jqGrid initialization script by yourself and use Lib.Web.Mvc only for request/response support on server side - please check the "jqGrid in ASP.NET MVC 3 and Razor" samples set from Downloads section.

Regards,
Tomasz Pęczek