开发者

Anyone know how to put a .net control in a google maps InfoWindow?

I was looking at some basic google maps stuff and found the following code on one of google's intro pages.

I used it as my POC and created a .net project from the concept. I now have markers and infoWindows being populated from the database which is pretty cool.

My problem is I want to add InfoWindows in a slick way (not only to the map, but also save to the db). Instead of having .net controls outside of the map window I want to be able to add info to the map directly. If the user clicks in the map I would like to be able to add a marker and InfoWindow with asp controls in the window (textbox and button).

Anyone know how to do this?

<html>
    <开发者_开发知识库head>
        <title>
            title here
        </title>
        <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
        <script type="text/javascript">
            function mapParamsInitialize() 
            {
                var latlng = new google.maps.LatLng(-34.397, 150.644);
                var myOptions = {
                    zoom: 8,
                    center: latlng,
                    mapTypeId: google.maps.MapTypeId.SATELLITE
                };

                var map = new google.maps.Map(document.getElementById("map"), myOptions);
                var contentString = '<div id="content"> Here is some text that will display in an infoWindow, or \'bubble\' </div>'; 
                var infowindow = new google.maps.InfoWindow({ content: contentString }); 
                var marker = new google.maps.Marker({ position: latlng, map: map, title: "Custom Window here" }); 
                google.maps.event.addListener(marker, 'click', function () { infowindow.open(map, marker); });
            }
        </script>
    </head>

    <body onload="mapParamsInitialize()">
        <div id="map" style="width:100%; height:100%"></div>
    </body>


create a div tag and set Z-index dynamically or if possible try to use some Asp.net pop up control which you can call from client side. I had a similar requirement and I was able to manage it with Devexpress AspxPopup control. Popup control then had an Iframe within it to load information from a database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜