Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.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
Asp.net mvc mvc中如何将另一个列表绑定到telerik网格_Asp.net Mvc_Telerik - Fatal编程技术网

Asp.net mvc mvc中如何将另一个列表绑定到telerik网格

Asp.net mvc mvc中如何将另一个列表绑定到telerik网格,asp.net-mvc,telerik,Asp.net Mvc,Telerik,我真的被困在这里了。 如何将另一个列表数据的列表绑定到MVC中的Telerik网格 例如: public class GetTripDetailsResponse { public DateTime PersonalDriveDate { set; get; } public List<AllDrivesInfo> AllDrives { set; get; } } public class AllDrivesInfo { public int TripId

我真的被困在这里了。 如何将另一个列表数据的列表绑定到MVC中的Telerik网格

例如:

public class GetTripDetailsResponse
{
    public DateTime PersonalDriveDate { set; get; }
    public List<AllDrivesInfo> AllDrives { set; get; }
}

public class AllDrivesInfo
{
    public int TripId { set; get; }
    public string Time { set; get; }
    public string Where { set; get; }
    public decimal Miles { set; get; }
    public decimal Value { set; get; }
    public string Purpose { set; get; }
}
公共类GetTripDetails响应
{
公共日期时间PersonalDriveDate{set;get;}
公共列表所有驱动器{set;get;}
}
公共类AllDrivesInfo
{
public int TripId{set;get;}
公共字符串时间{set;get;}
公共字符串,其中{set;get;}
公共十进制英里数{set;get;}
公共十进制值{set;get;}
公共字符串用途{set;get;}
}

现在如何将其绑定到Telerik网格?如何绑定到列?如何显示数据?

请使用下面的代码从另一个列表绑定列表

 public ActionResult GetDrivesInfo()
        {

            List<AllDrivesInfo> AllDrives = null;

            var objDrive = new AllDrivesInfo { TripId = 1, Time = "Time", Where = "where", Miles = 10, Value = 20, Purpose = "my purpose" }; //Get Code here

            foreach (AllDrivesInfo d in objDrive)
            {

                AllDrives.Add(new AllDrivesInfo { TripId = d.TripId, Time = d.Time, Where = d.Where, Miles = d.Miles, Value = d.Value, Purpose = d.Purpose });
            }

        }
Gridview

.Read(read => read.Action("Drives_Get", "Drives"))
.Read(read => read.Action("Drives_Get", "Drives"))