Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
3.86/5 (3 votes)
See more:
C#
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="mapsettings.aspx.cs" Inherits="mapsettings" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

   <script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC6v5-2uaq_wusHDktM9ILcqIrlPtnZgEk&sensor=false">
</script>
<script type="text/javascript">
    function initialize() {
        var lat = document.getElementById('txtlat').value;
        var lon = document.getElementById('txtlon').value;
        var myLatlng = new google.maps.LatLng(lat, lon) // This is used to center the map to show our markers
        var mapOptions = {
            center: myLatlng,
            zoom: 6,
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            marker: true
        };
        var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
        var marker = new google.maps.Marker({
            position: myLatlng
        });
        marker.setMap(map);
    }
</script>
    
    
    
     <form id="form1"  runat="server">
<table>
<tr>
<td>Enter Latitude:</td>
<td><input type="text" id="txtlat" value="13.053147716796578" /> </td>
</tr>
<tr>
<td>Enter Longitude:</td>
<td><input type="text" id="txtlon" value="80.2501953125" /> </td>
</tr>
<tr>
<td></td>
<td><input type="button" value="Submit"  önclick="javascript: initialize()" /> </td>
</tr>
</table>
<div id="map_canvas" style="width: 500px; height: 400px"></div>
</form>


when i run this code i get an error help me to fix it.
A page can have only one server-side Form tag.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: A page can have only one server-side Form tag.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Posted
Updated 15-Apr-14 2:05am
v4

1 solution

Here is the solution for your problem.Please try it. :)

Quote:
it's indeed only allowed to have one, visible, server form on one page (even in combination with a master page).

So simply remove <form id="form1" runat="server"> and the closing </form> tag and you should be good to go.

Another link :

A page can have only one server-side Form tag.[^]
 
Share this answer
 
v5
Comments
Sunasara Imdadhusen 15-Apr-14 6:10am    
I think this solution will help you!
Sampath Lokuge 15-Apr-14 7:29am    
Thanks Sunasara. :)
Bajpangosh 15-Apr-14 9:44am    
thnaks it's works. bro can u help a pointer can + set the value to box and save to database any ideas..?
Sampath Lokuge 15-Apr-14 9:50am    
You're warmly welcome.If you feel this is the Answer,Plz Accept it.It'll help for the user who will have the same issue in the future.Plz put your next question on new thread and let me know.I'll try then. :)
Bajpangosh 15-Apr-14 11:25am    
here mine question :)

http://www.codeproject.com/Questions/759961/How-Do-I-Make-A-Geo-Location-Tag-With-Google-Maps

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900