Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7163711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:56:54+00:00 2026-05-28T13:56:54+00:00

I m trying to display the google map in a pop up. I m

  • 0

I m trying to display the google map in a pop up.
I m getting the “The TargetControlID of ‘ModalPopupExtender’ is not valid. A control with ID ‘button1’ could not be found.” error.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
 <%@  Register TagPrefix="ajaxToolkit" Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <script type="text/javascript">
         function load1(ModalId,map1) {

             var popup = $find(ModalId);
             popup.show();

         load();
         showAddress();
     }

      function load() {
         document.getElementById("map1").style.display = "block";

         if (GBrowserIsCompatible()) {
             var map = new GMap2(document.getElementById("map"));
             map.addControl(new GSmallMapControl());
             map.addControl(new GMapTypeControl());

             var center = new GLatLng(19.0759837, 72.8776559);
             map.setCenter(center, 11);
             map.setMapType(G_SATELLITE_MAP);
             geocoder = new GClientGeocoder();

             var marker = new GMarker(center, { draggable: true });
             map.addOverlay(marker);
             document.getElementById("TextBox5").value = center.lat();
             document.getElementById("TextBox6").value = center.lng();

             geocoder = new GClientGeocoder();

             GEvent.addListener(marker, "dragend", function () {
                 var point = marker.getPoint();
                 map.panTo(point);
                 document.getElementById("TextBox5").value = point.lat();
                 document.getElementById("TextBox6").value = point.lng();
             });

             GEvent.addListener(map, "moveend", function () {
                 map.clearOverlays();
                 var center = map.getCenter();
                 var marker = new GMarker(center, { draggable: true });
                 map.addOverlay(marker);
                 document.getElementById("TextBox5").value = center.lat();
                 document.getElementById("TextBox6").value = center.lng();

                 GEvent.addListener(marker, "dragend", function () {
                     var point = marker.getPoint();
                     map.panTo(point);
                     document.getElementById("TextBox5").value = point.lat();
                    document.getElementById("TextBox6").value=point.lng();  
                 });
             });
         }
     }

     function showAddress() {
         address = document.getElementById("TextBox4").value;
         var map = new GMap2(document.getElementById("map"));
         map.addControl(new GSmallMapControl());
         map.addControl(new GMapTypeControl());
         if (geocoder) {
             geocoder.getLatLng(
address,
function (point) {
    if (!point) {
        alert(address + " city not found !");
    }
    else {
        document.getElementById("TextBox5").value = point.lat();
        document.getElementById("TextBox6").value = point.lng();
        map.clearOverlays()
        map.setCenter(point, 14);
        var marker = new GMarker(point, { draggable: true });
        map.addOverlay(marker);
    GEvent.addListener(marker, "dragend", function () {
        var pt = marker.getPoint();
        map.panTo(pt);
        document.getElementById("TextBox5").value = pt.lat();
        document.getElementById("TextBox6").value = pt.lng();
    });

    GEvent.addListener(map, "moveend", function () {
        map.clearOverlays();
        var center = map.getCenter();
        var marker = new GMarker(center, { draggable: true });

        map.addOverlay(marker);
        document.getElementById("TextBox5").value = center.lat();
        document.getElementById("TextBox6").value = center.lng();

        GEvent.addListener(marker, "dragend", function () {
            var pt = marker.getPoint();
            map.panTo(pt);
            document.getElementById("TextBox5").value = pt.lat();
            document.getElementById("TextBox6").value = pt.lng();
        });


      });
    } 
}
);
             } 
         }
</script>
 <script language="JavaScript">
<!--
     var message = "";
     function clickIE() { if (document.all) { (message); return false; } }
     function clickNS(e) {
         if
(document.layers || (document.getElementById && !document.all)) {
             if (e.which == 2 || e.which == 3) { (message); return false; } 
         } 
     }
     if (document.layers)
     { document.captureEvents(Event.MOUSEDOWN); document.onmousedown = clickNS; }
     else { document.onmouseup = clickNS; document.oncontextmenu = clickIE; }
     document.oncontextmenu = new Function("return false")
// -->
    </script>
</head>
<body>
<asp:ScriptManager ID="ScriptManager" runat="server" />
    <form id="form1" runat="server">
    <div>

        Name:
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <br />
        Address:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <br />
        <br />
        City:<asp:TextBox ID="TextBox3" runat="server" style="margin-bottom: 0px"></asp:TextBox>
        <br />
        <br />
        Pincode:<asp:TextBox ID="TextBox4" runat="server" style="margin-bottom: 0px"></asp:TextBox>
        <br />
        <br />
        Latitude:<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
        <br />
        <br />
        Longitude:<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
     <asp:Button ID="button1" value="Show on Map" onclick="javascript:load1('ModalPopup','map1');" ></asp:Button>
       <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="button1"
          PopupControlID="map1" BackgroundCssClass="modalBackground" CancelControlID="CloseMapButton"
          DropShadow="false" BehaviorID="ModalPopup" PopupDragHandleControlID="mapHeader" />
    <div style="display:none;margin-top:100px;margin-left:100px;" id="map1" class="row" >

    <div align="center" id="map" style="width:600px; height: 400px;"> 
                </div>
    </div>
    </div>


        </form>
        </body>
        </html>

I can’t understand why it is giving the targetcontrolid cannot be found.
Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:56:55+00:00Added an answer on May 28, 2026 at 1:56 pm

    I solved it. I added a hidden field above the modal popup and gave the id of the hidden field as the targetcontrolID.
    Thanks all for viewing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to display a Google Map inside a drupal page. The map will
I am trying to display google map as a tooltip using qTip jquery plugin.
Am trying to dispaly a basic google map on my application but that's not
I am trying to display a Google map when a user searches for a
I'm trying to set up a Google map that will display when a link
I'm trying to display a Google map from within a WebWorks app. Here is
I am trying to use JSNI to display a Google Map within an Application.
i am trying to display google map on Android refering to this tutorial http://developer.android.com/resources/tutorials/views/hello-mapview.html
I'm trying to display a google map on a webpage. The address that the
I'm trying to display a sidebar on the left side of a google map.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.