我正在尝试获取 JSON 文档,将其放入列表中,然后将其绑定到 gridview。我尝试了几种不同的方法,但没有任何效果。这是我的代码,问题出在最后 4 行。
protected void Page_Load(object sender, EventArgs e)
{
var from = origin.Text;
var to = destination.Text;
var requesturl = @"http://maps.googleapis.com/maps/api/directions/json?origin =" + from + "&alternatives=false&units=imperial&destination=" + to + "&sensor=false;";
string content = file_get_contents(requesturl);
JavaScriptSerializer jss = new JavaScriptSerializer();
var d = jss.Deserialize<dynamic>(content);
List<string> sl = d;
GridView1.DataSource = content;
GridView1.DataBind();
}