json data to textboxes[server side code]

Apr 17 2014 11:50 PM
hi i am getting  the single row json data depending on selection of dropdownlist using web api , i want to bind that data to textboxes.
here is my code. 'insurance_master' is my table
 
 
                                                 
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string url = "http://localhost:50435/api/Insurance_Master/" + DropDownList1.SelectedValue;
WebRequest req = WebRequest.Create(url);
req.Method = "GET";
// req.Headers.Add("key");
req.ContentType = "application/json; charset=utf-8";
WebResponse resp = req.GetResponse();
Stream stream = resp.GetResponseStream();
StreamReader re = new StreamReader(stream);
String json = re.ReadToEnd();
json = "{\"insurancedetails\":" + json + "}";
wrapper w = (wrapper)new JavaScriptSerializer().Deserialize(json, typeof(wrapper));
}
public class wrapper
{
public List<insurance_master> insurancedetails { get; set; }
}
 
 
Help me,
Thanks in advance 
 

Answers (3)