Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JQGrid下拉列表_Javascript_Jquery_Asp.net_Jqgrid_Asp.net Mvc 5 - Fatal编程技术网

Javascript JQGrid下拉列表

Javascript JQGrid下拉列表,javascript,jquery,asp.net,jqgrid,asp.net-mvc-5,Javascript,Jquery,Asp.net,Jqgrid,Asp.net Mvc 5,我正在开发使用JQGrid的MVC应用程序。在JQGrid中,我需要显示CountryName,但当数据来自数据库Country属性为null时,我保存了CountryID public partial class { public int ID { get; set; } public string Name { get; set; } public string Code { get; set; } public int Co

我正在开发使用JQGrid的MVC应用程序。在JQGrid中,我需要显示CountryName,但当数据来自数据库Country属性为null时,我保存了CountryID

public partial class 
{
        public int ID { get; set; }
        public string Name { get; set; }
        public string Code { get; set; }
        public int CountryID { get; set; }
        public Nullable<System.DateTime> CreatedOn { get; set; }
        public Nullable<System.DateTime> UpdatedOn { get; set; }
        public string Description { get; set; }

        public virtual Country Country { get; set; }

    }

jqgrid不知道如何处理列模型中的Country.Name。我建议在你的部分类中有一个名为CountryName的新属性,如下所示

public partial class 
{
        public int ID { get; set; }
        public string Name { get; set; }
        public string Code { get; set; }
        public int CountryID { get; set; }
        public Nullable<System.DateTime> CreatedOn { get; set; }
        public Nullable<System.DateTime> UpdatedOn { get; set; }
        public string Description { get; set; }

        public virtual Country Country { get; set; }

       public string CountryName { get{return Country.Name ; }

    }
colModel: [
              { key: true, hidden: true, name: 'ID', index: 'ID', sorttype: 'int' },
              { name: 'Name', index: 'Name', editable: true, inlineEditing: { keys: true }, minlength: 6 },
              { name: 'Description', index: 'Description', editable: true, inlineEditing: { keys: true } },
              { name: 'CountryName', index: 'CountryName', editable: true, edittype: "select", editoptions: { value: citySelect() } },
            ],
colModel: [
              { key: true, hidden: true, name: 'ID', index: 'ID', sorttype: 'int' },
              { name: 'Name', index: 'Name', editable: true, inlineEditing: { keys: true }, minlength: 6 },
              { name: 'Description', index: 'Description', editable: true, inlineEditing: { keys: true } },
              { name: 'CountryName', index: 'CountryName', editable: true, edittype: "select", editoptions: { value: citySelect() } },
            ],