Adding google Maps to my web pages

Posted on 2009-04-28
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=";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
    LVL 3

    Accepted Solution

    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=";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

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

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Introduction (All good things must come to an end ( The original MySQL API ( has gone away, deprecated by PHP in Version 5.5, and removed from PHP in all curre…
    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now