Solved

wcf, asp.net, jquery / ajax call

Posted on 2015-02-06
1
138 Views
Last Modified: 2015-03-12
ServiceRef.QuoteServiceClient i = new ServiceRef.ProQuoteServiceClient();
string result = i.GetModelListJSon("088", "12345");
Response.Write(result);

I have above web service(jquery/ajax) called and result below string.

{"PackageKey":null,"PackageNo":1,"TotalPackages":1,"Status":"Ok","Data":"[{\"ModelNo\":\"D7L4U\",\"ModelName\":\"DDA PROGRAM 01/11\",\"NetPrice\":0.0,\"ListPrice\":1.0,\"AMDD\":1.0},]"}

How can I bind(using asp.net/c#) it with asp:dropdown with model no only as value and text?


{"PackageKey":null,"PackageNo":1,"TotalPackages":1,"Status":"Ok","Data":"[{\"ModelNo\":\"DDADTR17L4DU\",\"ModelName\":\"DDA PROGRAM 01/11\",\"NetPrice\":0.0,\"ListPrice\":1.0,\"AMD\":1.0},]"}
0
Comment
Question by:ITsolutionWizard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 25

Accepted Solution

by:
apeter earned 500 total points
ID: 40602930
You have to strip out the data part and bind that list to your control. But why that list coming as a string ? . Your output should be like below.

{"PackageKey":null,"PackageNo":1,"TotalPackages":1,"Status":"Ok","Data":[{"ModelNo":"DDADTR17L4DU","ModelName":"DDA PROGRAM 01/11","NetPrice":0.0,"ListPrice":1.0,"AMD":1.0}]}

Then you serialize them back to below classes using json serialised. Datum can be used to bind to your control

public class Datum
{
    public string ModelNo { get; set; }
    public string ModelName { get; set; }
    public double NetPrice { get; set; }
    public double ListPrice { get; set; }
    public double AMD { get; set; }
}

public class RootObject
{
    public object PackageKey { get; set; }
    public int PackageNo { get; set; }
    public int TotalPackages { get; set; }
    public string Status { get; set; }
    public List<Datum> Data { get; set; }
}
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question