pls smone help me!!!
i'm developed google map application and i assign an .. find longitude and latitude opperation to button click event.
so what happens is.. if someone input two cities as input to textboxes, this operation convert those cities to longitude and latitude values and store those values into label.
protected void Button1_Click(object sender, EventArgs e)
{
String Strt_Address = TextBox1.Text;
String End_Address = TextBox2.Text;
string geocodeUrl1 = string.Format(@"http://maps.googleapis.com/maps/api/geocode/xml?address={0}&sensor=false", Strt_Address);
string geocodeUrl2 = string.Format(@"http://maps.googleapis.com/maps/api/geocode/xml?address={0}&sensor=false", End_Address);
XmlDocument geocodeXmlDoc1 = new XmlDocument();
geocodeXmlDoc1.Load(geocodeUrl1);
XmlDocument geocodeXmlDoc2 = new XmlDocument();
geocodeXmlDoc2.Load(geocodeUrl2);
XmlNamespaceManager XmlMngr1 = new XmlNamespaceManager(geocodeXmlDoc1.NameTable);
XmlMngr1.AddNamespace("geo", @"http://www.w3.org/2003/01/geo/wgs84_pos#");
XmlNamespaceManager XmlMngr2 = new XmlNamespaceManager(geocodeXmlDoc2.NameTable);
XmlMngr2.AddNamespace("geo", @"http://www.w3.org/2003/01/geo/wgs84_pos#");
string sLong1 = geocodeXmlDoc1.DocumentElement.SelectSingleNode(@"//geometry/location/lat", XmlMngr1).InnerText;
string sLat1 = geocodeXmlDoc1.DocumentElement.SelectSingleNode(@"//geometry/location/lng", XmlMngr1).InnerText;
string sLong2 = geocodeXmlDoc2.DocumentElement.SelectSingleNode(@"//geometry/location/lat", XmlMngr2).InnerText;
string sLat2 = geocodeXmlDoc2.DocumentElement.SelectSingleNode(@"//geometry/location/lng", XmlMngr2).InnerText;
Label1.Text = sLong1 + ", " + sLat1;
Label2.Text = sLong2 + ", " + sLat2;
Page.ClientScript.RegisterStartupScript(Page.GetType(), "script",
"calcRoute()", true);
}
javascript call
so here i want assign it to two variable and according to those variable it will draw route.
function calcRoute() {
var travelMode = $("#travelMode option:selected").text();
var start = document.getElementById('<%= Label1.ClientID %>').value;
var end = document.getElementById('<%= Label2.ClientID %>').value;
can you plsss soeone tell me how to pass label value to javascript variable... which i assigned in c#.......