Take the 2-minute tour ×

I am doing a web application using asp.net in which I want to take an address from a user in a textBox and show this address in a google maps api (that I implemented in my web application) by a marker (the tear drop shaped thing). So can someone please give me the code for doing that?

share|improve this question
See the documentation, it is pretty clear. Possible duplicate of stackoverflow.com/questions/3926836/… –  geocodezip Dec 11 '12 at 21:34

1 Answer 1

up vote 0 down vote accepted

If you are looking for placing a marker on the map by taking an address, then you need to look at the Geocoding service first. The example and description is well documented so I am not providing any code related to it.


The example provided above will take input from a HTML input element. Since your question is about taking input from an Asp.net TextBox this is what you can do-

Suppose you have-

<asp:TextBox ID="txt_address" runat="server"> 
<asp:Button ID="btn_locate" runat="server" OnClientClick="codeAddress(); return false;">

instead of var address = document.getElementById("address").value; in the example,


var address= document.getElementById('<%=txt_address.ClientID%>').value;

Remember the return false in the Button source since that will prevent a postback on submit.

share|improve this answer

Your Answer


