Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Google Map InfoWIndow Content String Syntax

Status
Not open for further replies.

DeeMark

Programmer
Feb 10, 2005
15
GB
I have a an ASP.Net web site using vb.net code.In code behind file I am trying to populate the infowindow with content where I have to format a numeric variable to 2 decimal places.The variable is called from data in a connected sql server database.

The code I am using is

Code:
 overlayContents.Add(String.Format("{{ content: ""<div class=\""infoWindow\""><br /><br />{0}<br /><img src={1} height=120 width=100/><br />Distance:{2} Miles""}}", location("ID"), location("image"), location("DistanceFromAddress")))
The above code works but I wish to format the value for 'Distance' from location {2} to two decimal places from the sql database value which is a calculated field producing a large unformatted numeric value.

I am therefore trying to format the content string within the htm code. Or should I be concentrating on getting the sql server database value formatted first before calling it in the content string.
Any advice welcomed




 
Resolved: To avoid formatting issues in html code, the sql database calculated field was formatted i.e cast(123.45678 as numeric(10, 2))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top