I write code like below but its not work correctly.
protected void Button1_Click(object sender, EventArgs e)
{
string url = "http://maps.google.com/maps/api/geocode/xml?address=" + txtsearch.Text + "&sensor=false";
WebRequest request = WebRequest.Create(url);
using (WebResponse response = (HttpWebResponse)request.GetResponse())
{
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
DataSet dsResult = new DataSet();
dsResult.ReadXml(reader);
DataTable dtCoordinates = new DataTable();
dtCoordinates.Columns.AddRange(new DataColumn[4] { new DataColumn("Id", typeof(int)),
new DataColumn("Address", typeof(string)),
new DataColumn("Latitude",typeof(string)),
new DataColumn("Longitude",typeof(string)) });
var latitude = string.Empty;
var longitude = string.Empty;
if (dsResult.Tables["location"] != null && dsResult.Tables["location"].Rows.Count > 0)
{
latitude = dsResult.Tables["location"].Rows[0]["lat"].ToString();
longitude = dsResult.Tables["location"].Rows[0]["lng"].ToString();
map.Lattitude = float.Parse(latitude);
map.Longitude = float.Parse(longitude);
map.Radius = float.Parse(txtdemo.Text);
dsLocation= mapBL.GetLocation(map);
GridView2.DataSource = dsLocation;
GridView2.DataBind();
}
}
}
}
Please send correct code for that.