0
Answer

regarding google map

Karthick

Karthick

12y
1.3k
1
When i click on Map tab it wants to show google map with marker...

Here is my client side code:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
     
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAuPsJpk3MBtDpJ4G8cqBnjRRaGTYH6UMl8mADNa0YKuWNNa8VNxQCzVBXTx2DYyXGsTOxpWhvIG7Djw" type="text/javascript"></script>
    <script type="text/javascript">

        var map = null;
        var geocoder = null;
        var setLat = 51.618017;
        var setLon = 2.48291;


        function initialize() {
            if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map_canvas"));

                map.setCenter(new GLatLng(37.4419, -122.1419), 13);
                map.enableDoubleClickZoom();
                map.enableScrollWheelZoom();
                map.addControl(new GMapTypeControl());
                map.addControl(new GSmallMapControl());

                geocoder = new GClientGeocoder();
            }
        }
       </script>
<telerik:RadTabStrip ID="radtabGeneral" runat="server">
<Tabs>
 <telerik:RadTab Text="Map" Value="Map" SelectedCssClass="rtsDisabled" SelectedIndex="6"
  PageViewID="pvMap" ForeColor="GreenYellow">
 </telerik:RadTab>
 </Tabs>
 </telerik:RadTabStrip>
       
           ....
           ....
<telerik:RadPageView ID="pvMap" runat="server" Visible="true">
<div id="map_canvas" style="width:800px; height:600px"></div>
</telerik:RadPageView>

</asp:Content>

Here is my aspx.cs page:
 protected void Page_Load(object sender, EventArgs e)
{
if(this.IsPostBack)
{
HtmlGenericControl mybodytag = new HtmlGenericControl();
                //mybodytag = Page.FindControl("Map");
                mybodytag.FindControl("Content2");
                mybodytag.Attributes.Add("onload", "initialize()");
}
else
{
}
}
but it will not show the Google Map...



How can i call the script from the server in codebehind(in aspx.cs page).Please Give me the code.

Attachment: map.rar