944,198 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 5843
  • ASP.NET RSS
Nov 11th, 2009
0

Google Map in C#

Expand Post »
I am trying to develp a webpage that takes in TO and FROM Addres and displays the Google Map as well the directions.
I understand JScript helps out with the Google Map display and I played around with the URL google.maps.com to get the directions. Now my issue is I have to pass on the data from the C# to JScript and i m struck here..

ASP.NET Syntax (Toggle Plain Text)
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  4.  
  5. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  6.  
  7. <html xmlns="http://www.w3.org/1999/xhtml">
  8.  
  9. <head>
  10.  
  11. <script src="http://maps.google.com/maps?file=api&v=1
  12. &key=KEYS" type="text/javascript"> </script> </head> <body>
  13. <form id="form1" runat="server">
  14. <div id="map" style="width: 400px; height: 300px; margin-top: 48px;"></div> <script type="text/javascript">
  15. //<![CDATA[
  16. var x = -83.022206;
  17. var y = 39.998264;
  18. var map = new GMap(document.getElementById("map"));
  19. var point1 = new GPoint(x,y);
  20. var marker1 = new GMarker(point1);
  21. map.centerAndZoom(point1, 3);
  22. map.addOverlay(marker1);
  23. //Add Zoom in Zoom out
  24. map.addControl(new GLargeMapControl());
  25. map.addControl(new GMapTypeControl());
  26. //Add Marker
  27. var point = new GPoint(-83.015522, 40.002068);
  28. var marker = new GMarker(point);
  29. map.addOverlay(marker);
  30. //]]>
  31. </script>
  32. <div id="Div1" style="width: 400px; height: 97px; margin-top: 48px;">&nbsp;&nbsp;&nbsp; TO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  33. <asp:TextBox ID="TextBox1" runat="server" style="width: 128px; margin-right: 49px"></asp:TextBox> <br />
  34. &nbsp;&nbsp;&nbsp; FROM&nbsp;<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
  35. <br /> <asp:Button ID="Button1" runat="server" Height="34px" style="margin-left: 39px"
  36. Text="Button" Width="167px" onclick="Button1_Click" />
  37. <br /> <asp:GridView runat = server ID = "gridview"
  38. onselectedindexchanged="gridview_SelectedIndexChanged" AutoGenerateColumns = "false">
  39. <Columns> <asp:TemplateField> <ItemTemplate>
  40. <asp:Label ID="Label1" runat ="server" Text ='<% #Eval("value") %>' >
  41. </asp:Label>
  42. </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </div> </form> </body> </html>
Last edited by peter_budo; Nov 12th, 2009 at 5:57 am. Reason: Correcting code tags
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
GradStudent is offline Offline
16 posts
since Sep 2009
Nov 12th, 2009
0
Re: Google Map in C#
>Now my issue is I have to pass on the data from the C# to JScript and i m struck here..

Use GMap asp.net control.

SUMMARY: A custom server control wrapper for the Google Maps API. Developed for ASP.Net using C#, JavaScript, and XSL. The GMap control makes using Google Maps easy for .Net developers; allowing them to interact with Google Maps using standard .Net language

Take a look at an article - http://www.codeproject.com/KB/custom...lat-Part1.aspx
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: File Upload Control
Next Thread in ASP.NET Forum Timeline: Strange Issues on ASP.NET App





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC