我正在創建一個web應用程序。我希望能夠將Google地圖納入我的一頁中。 從我在其他地方看過的書中,最簡單的想法是將Web瀏覽器放到表單上,但工具箱中沒有「Web瀏覽器」。將asp.net中的Google地圖插入我的網頁
我想要做的是將一個位置插入一個文本框(即倫敦),並插入一種類型的運動(ieCycling)和結果地圖顯示出來。除了使用網絡瀏覽器工具之外,還有其他的方式可以在C#中完成這個工作。
這裏是我的代碼:
protected void btnSearch_Click(object sender, EventArgs e)
{
string sport = txtSport.Text;
string location = txtLocation.Text;
try
{
StringBuilder queryAddrress = new StringBuilder();
queryAddrress.Append("https://maps.google.ie/");
if (sport != string.Empty)
{
queryAddrress.Append(sport+","+"+");
}
if (location != string.Empty)
{
queryAddrress.Append(location + "," + "+");
}
Panel1.Navigate(queryAddrress.ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString(),"Error");
}
} protected void btnSearch_Click(object sender, EventArgs e)
{
string sport = txtSport.Text;
string location = txtLocation.Text;
try
{
StringBuilder queryAddrress = new StringBuilder();
queryAddrress.Append("https://maps.google.ie/");
if (sport != string.Empty)
{
queryAddrress.Append(sport+","+"+");
}
if (location != string.Empty)
{
queryAddrress.Append(location + "," + "+");
}
Panel1.Navigate(queryAddrress.ToString());
}
我試圖把地址轉換成面板,但是這顯然是錯誤的。任何幫助將不勝感激!