Home All Groups Group Topic Archive Search About

Google Maps & Master Pages

Author
11 Aug 2006 3:27 PM
MeerkatInFrance
There comes a time when you know you are not going to be able to work
something out yourself, however hard you try. I have reached that moment.

I have a master page and a slave page (or whatever one calls it)

All I want to do is show a Google map on the slave page.
The map that Google gives as an example when it gives you a key would be
just fine.

I have searched high and low for a means of doing this but all I could find
was half answers or the occasional clever remark from someone clever, which
didn't help me much.

What I would really love would be the three or four lines that I feel sure
would be all that is all that is needed.

Failing that, any help ( however obscure or cryptic ) would be very
gratefully received.

Many thanks,

MeerkatInFrance

Author
12 Aug 2006 2:46 PM
clintonG
I have no experience using Google maps -- yet -- but the "slave page" is
called a content page should you need to learn to use Google to search for
information.

What page at Google are you trying to reuse?

<%= Clinton Gallagher
        NET csgallagher AT metromilwaukee.com
        URL http://www.metromilwaukee.com/clintongallagher/



Show quote
"MeerkatInFrance" <MeerkatInFra***@hotmail.com> wrote in message
news:%235392qVvGHA.1512@TK2MSFTNGP04.phx.gbl...
> There comes a time when you know you are not going to be able to work
> something out yourself, however hard you try. I have reached that moment.
>
> I have a master page and a slave page (or whatever one calls it)
>
> All I want to do is show a Google map on the slave page.
> The map that Google gives as an example when it gives you a key would be
> just fine.
>
> I have searched high and low for a means of doing this but all I could
> find was half answers or the occasional clever remark from someone clever,
> which didn't help me much.
>
> What I would really love would be the three or four lines that I feel sure
> would be all that is all that is needed.
>
> Failing that, any help ( however obscure or cryptic ) would be very
> gratefully received.
>
> Many thanks,
>
> MeerkatInFrance
>
>
Author
12 Aug 2006 4:53 PM
MeerkatInFrance
Hi Clinton,

Thanks for the reply.
Believe me when I say I have searched everywhere for any answer using every
keyword imaginable.
It seems the only people who have managed to do this simple thing are
experts whose suggestions are way above my head.
All I am looking for is a simple expalnation answer to a simple question.
I don't care what map is displayed, any one in the whole world will do.
I am certain many people would be grateful for an answer, not least, those
who have tried get an answer but failed.

Once again, thanks for talking the trouble to reply. Hopefully some other
kind person will come up with some ideas.

Regards,  Pete.


Show quote
"clintonG" <csgallag***@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:eKYta4hvGHA.2260@TK2MSFTNGP03.phx.gbl...
>I have no experience using Google maps -- yet -- but the "slave page" is
>called a content page should you need to learn to use Google to search for
>information.
>
> What page at Google are you trying to reuse?
>
> <%= Clinton Gallagher
>        NET csgallagher AT metromilwaukee.com
>        URL http://www.metromilwaukee.com/clintongallagher/
>
>
>
> "MeerkatInFrance" <MeerkatInFra***@hotmail.com> wrote in message
> news:%235392qVvGHA.1512@TK2MSFTNGP04.phx.gbl...
>> There comes a time when you know you are not going to be able to work
>> something out yourself, however hard you try. I have reached that moment.
>>
>> I have a master page and a slave page (or whatever one calls it)
>>
>> All I want to do is show a Google map on the slave page.
>> The map that Google gives as an example when it gives you a key would be
>> just fine.
>>
>> I have searched high and low for a means of doing this but all I could
>> find was half answers or the occasional clever remark from someone
>> clever, which didn't help me much.
>>
>> What I would really love would be the three or four lines that I feel
>> sure would be all that is all that is needed.
>>
>> Failing that, any help ( however obscure or cryptic ) would be very
>> gratefully received.
>>
>> Many thanks,
>>
>> MeerkatInFrance
>>
>>
>
>
Author
12 Aug 2006 6:01 PM
Dave Johnson
hello,

actually u dont make much sense talking about master\content page and
google maps api, however i will be glad to help if u can rephrase your
problem if that possible please. my first google search was this link i
am sure if you searched u have been there but i am including it in my
post anyway, hope tht help and feel free to join me in your development!

http://www.codeguru.com/Csharp/.NET/net_asp/controls/article.php/c10539/

Sharing makes All the Difference

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Author
12 Aug 2006 9:16 PM
clintonG
Pete, in so many words you've said twice now that you don't really care what
type of map you get so I'm wondering why you don't try to get one from
another provider? Its very easy to go to a site like MapQuest or perhaps
even Expedia both of which allow making a query to generate a map and then
copying and pasting code they provide that links to the map from a web page.
Even Yahoo supports this too I think.

If that is acceptable try that out, otherwise if its absolutley neccessary
to learn to use code at this time the .NET control that Dave just referred
us to [1] is a very interesting option I intend to study myself. Thank you
for bringing that to our attention Dave. I could handle the coding but at
the moment I would like something simple until I have the time to go study a
new API to take advantage of broader opportunities. Dragging a control into
a page and setting some properties is my idea of getting something done
lickity split. ;-)

<%= Clinton Gallagher
        NET csgallagher AT metromilwaukee.com
        URL http://www.metromilwaukee.com/clintongallagher/

[1] http://www.codeguru.com/Csharp/.NET/net_asp/controls/article.php/c10539/



Show quote
"Dave Johnson" <esharpco***@gmail.com> wrote in message
news:%23WpsHljvGHA.4872@TK2MSFTNGP02.phx.gbl...
> hello,
>
> actually u dont make much sense talking about master\content page and
> google maps api, however i will be glad to help if u can rephrase your
> problem if that possible please. my first google search was this link i
> am sure if you searched u have been there but i am including it in my
> post anyway, hope tht help and feel free to join me in your development!
>
> http://www.codeguru.com/Csharp/.NET/net_asp/controls/article.php/c10539/
>
> Sharing makes All the Difference
>
> --
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com
Author
15 Aug 2006 8:01 AM
MeerkatInFrance
Hello Clinton,
I apologise for not responding earlier.
You say you are going to study the Bill Pierce article.
If you ever decide to display a Google Map in a Master Page, I wonder if you
could let me know how you get on as I am still unable to do this.
I shall check this newsgroup every day in the hope of a response.

Many thanks,

Pete.




Show quote
"clintonG" <csgallag***@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:uHFvfSlvGHA.4624@TK2MSFTNGP02.phx.gbl...
> Pete, in so many words you've said twice now that you don't really care
> what type of map you get so I'm wondering why you don't try to get one
> from another provider? Its very easy to go to a site like MapQuest or
> perhaps even Expedia both of which allow making a query to generate a map
> and then copying and pasting code they provide that links to the map from
> a web page. Even Yahoo supports this too I think.
>
> If that is acceptable try that out, otherwise if its absolutley neccessary
> to learn to use code at this time the .NET control that Dave just referred
> us to [1] is a very interesting option I intend to study myself. Thank you
> for bringing that to our attention Dave. I could handle the coding but at
> the moment I would like something simple until I have the time to go study
> a new API to take advantage of broader opportunities. Dragging a control
> into a page and setting some properties is my idea of getting something
> done lickity split. ;-)
>
> <%= Clinton Gallagher
>        NET csgallagher AT metromilwaukee.com
>        URL http://www.metromilwaukee.com/clintongallagher/
>
> [1]
> http://www.codeguru.com/Csharp/.NET/net_asp/controls/article.php/c10539/
>
>
>
> "Dave Johnson" <esharpco***@gmail.com> wrote in message
> news:%23WpsHljvGHA.4872@TK2MSFTNGP02.phx.gbl...
>> hello,
>>
>> actually u dont make much sense talking about master\content page and
>> google maps api, however i will be glad to help if u can rephrase your
>> problem if that possible please. my first google search was this link i
>> am sure if you searched u have been there but i am including it in my
>> post anyway, hope tht help and feel free to join me in your development!
>>
>> http://www.codeguru.com/Csharp/.NET/net_asp/controls/article.php/c10539/
>>
>> Sharing makes All the Difference
>>
>> --
>> Sent via .NET Newsgroups
>> http://www.dotnetnewsgroups.com
>
>
Author
13 Aug 2006 1:58 PM
MeerkatInFrance
Hello Dave,
I am very excited by your offer to help because I really do want to get this
solved.
You say I didn't make much sense when describing the problem, so I am going
to try much harder to make things more clear.
I thought I explained things before but no one seems to know what I am on
about so here is my second attempt.



By the way, the Bill Pierce article that you reference is excellent and I
learnt a great deal from it.



If you look at the first comment, you will see that someone had a problem
getting the control to work with Master Pages.
http://www.codeproject.com/aspnet/LatLaysFlat-Part4.asp



However, I think my problem is far simpler than that.



In order to display a Google map, one has to apply for a key and

Google sends back a page similar to the following:


Thank you for signing up for a Google Maps API key!
-----------------------------------------------------------------



Your key is:
--------------
   ABQIAAAAs5UE471qW8DM4jCbPbQK7xTqmISFW6ihj9DyVBKjLCKBPkEuVhQavH-o3oN4agIcY3H_Xwx41dojtQ



Here is an example web page to get you started ...
-----------------------------------------------------------------



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script
src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAs5UE471qW8DM4jCbPbQK7xTqmISFW6ihj9DyVBKjLCKBPkEuVhQavH-o3oN4agIcY3H_Xwx41dojtQ"
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
      }
    }
    //]]>
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 500px; height: 300px"></div>
  </body>
</html>



-----------------------------------------------------------------



This sample page works perfectly as a standard aspx page. So far so good!



My problem is that I want to display this page in a Content Page but I
cannot do it.

(Master Pages use Content Pages. Please let me know if this needs further
explanation)
I am looking for someone to let me know exactly what needs to be done.
As I mentioned before, I believe there must be many people out there who
want to do the same thing and who would also be grateful for any help.



I am really hoping that this attempt is sufficient to explain what I am
trying to do, but if it is not, then I will happily try again.

Waiting with fingers well and truly crossed for some help.



Pete.
Author
16 Aug 2006 10:43 PM
Dave Johnson
hello pete,
i am sorry as i was really busy lately, however i tried compelte the
task myself and i got stucked early as i couldnt use the key on the
local host(no domain)! however i think the solution for you is simple
and clear as you said

>This sample page works perfectly as a standard aspx page. So far so
good!
>
>
>
>My problem is that I want to display this page in a Content Page but I
>cannot do it.

i think u should try developing it in a WebUserControl(.ascx) instead of
a standard aspx page. then just simply darp and drop the WebUserControl
into your master page.

i am sure its gonna work,

Sharing makes All the Difference

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Author
16 Aug 2006 11:31 PM
MeerkatInFrance
Hi Dave,
Yes it is almost certainly simple but no one has yet been kind enough to
lend a hand :-(
In reference to your key problem,
when you apply for key, try
My web site URL: http://localhost
I worked for me !
Hope that was of some use.

Regards,

Pete.


Show quote
"Dave Johnson" <esharpco***@gmail.com> wrote in message
news:uyuIaVYwGHA.4868@TK2MSFTNGP02.phx.gbl...
> hello pete,
> i am sorry as i was really busy lately, however i tried compelte the
> task myself and i got stucked early as i couldnt use the key on the
> local host(no domain)! however i think the solution for you is simple
> and clear as you said
>
>>This sample page works perfectly as a standard aspx page. So far so
> good!
>>
>>
>>
>>My problem is that I want to display this page in a Content Page but I
>>cannot do it.
>
> i think u should try developing it in a WebUserControl(.ascx) instead of
> a standard aspx page. then just simply darp and drop the WebUserControl
> into your master page.
>
> i am sure its gonna work,
>
> Sharing makes All the Difference
>
> --
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com
Author
18 Aug 2006 3:14 PM
clintonG
It may not be pertinent but the following solution does use Google Earth so
here's a fast way to get something going [1] and here [2] is some code you
can copy into a page to see what results look and feel like using my own
location. Note once you get the HTML from Wikimapia the width and height
dimensions can be modified at will so you can put the iframe into a page and
tweak until it is sized right for the page you are using it with. Its also
an easy way to get coordinates for your site as you can see I've added mine
to my sig :-)

Now if somebody develops an app that a set of coordinates can be copied into
so a map will be generated having coordinates will become much more useful
for public exposure. Once we create the map we can always copy the URL and
send that around...

<%= Clinton Gallagher
        NET csgallagher AT metromilwaukee.com
        URL http://clintongallagher.metromilwaukee.com/
        MAP 43°2'17"N  88°2'37"W : 43°2'17"N  88°2'37"W

[1]
http://wikimapiablog.blogspot.com/2006/08/how-to-add-google-map-to-any-web-page.html
[2] <iframe src=http://wikimapia.org/s/#y=43038517&x=-88044455&z=17&l=0&m=h
width=720 height=300 frameborder=0></iframe>
[3] http://wikimapia.org/#y=43038073&x=-88043838&z=17&l=0&m=h


Show quote
"MeerkatInFrance" <MeerkatInFra***@hotmail.com> wrote in message
news:egx3ewYwGHA.1888@TK2MSFTNGP03.phx.gbl...
> Hi Dave,
> Yes it is almost certainly simple but no one has yet been kind enough to
> lend a hand :-(
> In reference to your key problem,
> when you apply for key, try
> My web site URL: http://localhost
> I worked for me !
> Hope that was of some use.
>
> Regards,
>
> Pete.
>
>
> "Dave Johnson" <esharpco***@gmail.com> wrote in message
> news:uyuIaVYwGHA.4868@TK2MSFTNGP02.phx.gbl...
>> hello pete,
>> i am sorry as i was really busy lately, however i tried compelte the
>> task myself and i got stucked early as i couldnt use the key on the
>> local host(no domain)! however i think the solution for you is simple
>> and clear as you said
>>
>>>This sample page works perfectly as a standard aspx page. So far so
>> good!
>>>
>>>
>>>
>>>My problem is that I want to display this page in a Content Page but I
>>>cannot do it.
>>
>> i think u should try developing it in a WebUserControl(.ascx) instead of
>> a standard aspx page. then just simply darp and drop the WebUserControl
>> into your master page.
>>
>> i am sure its gonna work,
>>
>> Sharing makes All the Difference
>>
>> --
>> Sent via .NET Newsgroups
>> http://www.dotnetnewsgroups.com
>
>
Author
29 Aug 2006 10:51 PM
Alan Silver
In article <e27UXCuvGHA.5***@TK2MSFTNGP06.phx.gbl>, MeerkatInFrance
<MeerkatInFra***@hotmail.com> writes
>My problem is that I want to display this page in a Content Page but I
>cannot do it.

I don't know for certain if this is relevant, but I wouldn't be at all
surprised if the problem is that the Javascript called references
controls/elements on the page whose IDs are changed when you use master
pages. This is a common complaint about master pages, which is not too
hard to avoid when you are writing your own Javascript, but a serious
pain when using someone else's.

If you don't know what I'm talking about, create a master and content
page, then add a control to the content. Look at the generated (X)HTML
from the View->Source option in your browser, and see what ID the
control gets when it is rendered. With a simple (ie no master page)
..aspx page, the ID will probably be the same as the one you gave the
server side control. With master pages, the framework gives it a more
complex name, built up from the IDs of any parents, including the master
itself. This is done to avoid ID name conflicts, but means that your
client side IDs are a pain to predict and can easily change.

I hope this helps you understand the problem, although if I'm right,
then there's not much you can do about it unless you are prepared to
rewrite Google's Javascript code (which I wouldn't recommend!!).

HTH

--
Alan Silver
(anything added below this line is nothing to do with me)
Author
5 Sep 2006 5:39 AM
Freddy Guime
I had just the same problem, so after fiddling with it a little bit, I
managed to get it to work.

The content body (within the aspx page) would look like this...

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=some
long key here"
      type="text/javascript"></script>
<script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
      }
    }
    //]]>
    </script>



  <div id="map" style="width: 500px; height: 300px"></div>



The interesting part is that I needed to create two master pages, a
standard one, and a copy with the <Body onload events> required by
google...

<body  onload="load ();" onunload="GUnload()">


not that elegant but it will work. I'm trying to find out a
programatically way to add the onload/unload events into the master page
body tag so that I can use one master page. Until then, this will
work...

Hope this helps...


*** Sent via Developersdex http://www.developersdex.com ***
Author
5 Sep 2006 11:18 AM
Alan Silver
In article <#bEme2K0GHA.1***@TK2MSFTNGP03.phx.gbl>, Freddy Guime
<fgu***@uic.edu> writes
>        var map = new GMap2(document.getElementById("map"));

You could just try changing this one line to...

var map = new GMap2(document.getElementById("<%= map.ClientID %>"));

Although this would require you to add runat="server" to the <div>
element. See my previous post as to why.

HTH

--
Alan Silver
(anything added below this line is nothing to do with me)
Author
8 Sep 2006 1:47 PM
GhoriG
Freddy Guime wrote:
> not that elegant but it will work. I'm trying to find out a
> programatically way to add the onload/unload events into the master page
> body tag so that I can use one master page. Until then, this will
> work...

Here's what I did.

On the MASTER page, give the body tag an ID and runat server.
<body id="BodyID" runat="server">

On the CONTENT page

First declare your variable

Protected MasterPageBodyTag As
System.Web.UI.HtmlControls.HtmlGenericControl

Then on the Page_OnLoad event
add the following lines of code

MasterPageBodyTag = Me.Master.FindControl("BodyID")
MasterPageBodyTag.Attributes.Add("OnUnload", "GUnload()")
MasterPageBodyTag.Attributes.Add("OnLoad", "Load();")

Hope that helps.

AddThis Social Bookmark Button