Adding google Maps to my web pages

Posted on 2009-04-28
Medium Priority
Last Modified: 2012-05-06
I need to dynamically add the address to the code below, I have tried server tags and could not get them to work. the error stated that the variable did not exist in the current context when I used the server side tag inline in my webpage.  See "myLocations=" in the code, this is where I would like to insert the variable from my querystring that I captured using simple strings and or stringbuilder.
<body onload="initialize()" onunload="GUnload()"> <div align="center" id="map_canvas" style="width: 250px; height: 80px"></div> <div align="center" style="width: 250px; height: 80px"><script src="http://www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/114281111391296844949/driving-directions.xml&amp;up_myLocations=1121%20Spring%20Lake%20Dr%2C%20Itasca%2C%20IL&amp;synd=open&amp;w=400&amp;h=80&amp;title=DDC+Driving+Directions&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script></div></body>

Open in new window

Question by:bharris133

Accepted Solution

kssoftware earned 2000 total points
ID: 24256731
I used the following code and all seemed to work. I replaced the address after up_MyLocations= with
<%= Request.querystring("address") %>
Then calling the page with any valid address (correctly encoded with %20 for spaces and %2C for commas) places the destination address in the correct box.

I have removed your javascript functions "initialize" and "GUnload" for the purpose of testing.
    <form id="form1" runat="server">
        <div align="center" id="map_canvas" style="width: 250px; height: 80px">
        <div align="center" style="width: 250px; height: 80px">
            <script type="text/javascript" 
            src="http://www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/114281111391296844949/driving-directions.xml&amp;up_myLocations=<%= Request.querystring("address") %>&amp;synd=open&amp;w=400&amp;h=80&amp;title=DDC+Driving+Directions&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>

Open in new window


Author Closing Comment

ID: 31575739
Great thanks by the way the syntax for requesting the querystring needed to be corrected.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses
Course of the Month15 days, 12 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question