hi experts, I just want to learn how to bind json string to asp.net repeater & datatable.
Please show me how. I am not an expert of asp.net framework.
Thanks
Return json string:
[
{"FleetID":6045,"Make":"Kenworth","Model":"T800","FleetMasterType":"Tow","FleetClassType":"Tow Truck","FleetClassSubType":"Heavy Duty Wrecker"},
{"FleetID":6046,"Make":"Freightliner","Model":"Business Class M2 106","FleetMasterType":"Tow","FleetClassType":"Tow Truck","FleetClassSubType":"Medium Duty Trucks Roll-back"}
]
public string GetFleetList(string FleetMasterType, string responseType)
{
string RegIDvalue = "0";
using (System.Net.WebClient client = new System.Net.WebClient())
{
var reqparm = new System.Collections.Specialized.NameValueCollection();
reqparm.Add("FleetMasterType", FleetMasterType);
byte[] responsebytes = client.UploadValues(domain + "/api/Fleet/GetFleetList?type="+ responseType, "POST", reqparm);
string responsebody = Encoding.UTF8.GetString(responsebytes);
if (responseType == "xml")
{
RegIDvalue = GetResponseValue(responsebody, "Fleet", "FleetClassType");
}
else
{
RegIDvalue = responsebody;
}
}
return RegIDvalue;
}
Open in new window