Click here to Skip to main content
16,017,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello

actually i retrieve the whole address to text box(ie.street,city,state).i want to pass this address to the Google map so how can i make that whole address to URL.

what will i modify with that code
Response.Redirect("http://www.google.com/maps??hl=en&q=" + TextBox1.Text.ToString() + "");


the above code get only the 1st word means (street) not all the address.
Posted

You can Replace the Space with Empty one
string Custname = txtCustName.Text.Replace(" ", "").ToString();
 
Share this answer
 
v2
Comments
Toniyo Jackson 13-Dec-10 7:11am    
Always put code inside code block.
Try this idea

using some charactors like (! , |) between the address and street then

replace this charactos to "" (the above code).
 
Share this answer
 
If your problem is that your TextBox is multiple lines, so that only the first line gets passed to the Google query string, then what you need to do is replace any line feeds and carriage returns with something appropriate so that it comes out as a single line of text. An example:
C#
Response.Redirect("http://www.google.com/maps??hl=en&q=" + TextBox1.Text.ToString().Replace(Environment.NewLine, ", ")) + "");

In this example I replaced the the carriage return and/or the line feed with a comma and space.

However, if you are looking to get your query formatted right for Google:
Here[^] is a good reference regarding the Google map query and all of its parameters.
 
Share this answer
 
v2

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