asp.net mvc - How to bind list of another list to telerik grid in mvc -
i got stuck here. how bind list of list data telerik grid in mvc?
example:
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 { set; get; } public decimal miles { set; get; } public decimal value { set; get; } public string purpose { set; get; } }
now how bind telerik grid? how bind columns? how display data?
please use below code bind list list.
public actionresult getdrivesinfo() { list<alldrivesinfo> alldrives = null; var objdrive = new alldrivesinfo { tripid = 1, time = "time", = "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, = d.where, miles = d.miles, value = d.value, purpose = d.purpose }); } }
bind telerik gridview
you need return json result bind gridview:
public actionresult drives_get([datasourcerequest] datasourcerequest request) { //bind "driveslist" here return json(drivesmodel.driveslist.todatasourceresult(request)); }
gridview
.read(read => read.action("drives_get", "drives"))
Comments
Post a Comment