问题描述
请smone帮助我!!!
我开发了谷歌地图应用程序,我指定了..找到经度和纬度操作按钮点击事件。
/>
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);
// i'm calling my js function from here.......
}
javascript电话
所以我想把它分配给两个变量并根据这些变量绘制路线。
javascript call
so here i want assign it to two variable and according to those variable it will draw route.
function calcRoute() {
// get the travelmode, startpoint and via point from the form
var travelMode = $("#travelMode option:selected").text();
var start = document.getElementById('<%= Label1.ClientID %>').value;
var end = document.getElementById('<%= Label2.ClientID %>').value;
你可以告诉我如何将标签值传递给javascript变量......我在c#.......
can you plsss soeone tell me how to pass label value to javascript variable... which i assigned in c#.......
推荐答案
你可以告诉我如何将标签值传递给javascript变量...我在c#.......
can you plsss soeone tell me how to pass label value to javascript variable... which i assigned in c#.......
var start =<%=Label1.Text%>;
var end = <%=Label2.Text%>;
这篇关于请有人帮助我......我遇到了麻烦。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!