troubleshooting Question

consume json using asp.net

Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America asked on
ASP.NETJSON
7 Comments1 Solution20 ViewsLast Modified:
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;
        }
ASKER CERTIFIED SOLUTION
David H.H.Lee
Digital Marketing (Hospitality)
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros