This project is read-only.

Still render problems i tabpanel?

Jul 27, 2008 at 12:17 PM

Hallo Velio

 

I seem to having some problems with this control.

 

1)      Map inside tabpanel only draws 50% of map
this was solved in “3227 Map inside tabpanel only draws 50% of map”?
I still have that problem with the newest version – 2.9/3.4. The marker is placed at coor. 0,0 and the pan is “panned” up and left.
Screenshot:
http://leflank.dk/error/GoogleMapTabAjaxError1.png

2)      Dll file indicate version 2.9 when I right click and show properties. The file was downloaded from
http://www.codeplex.com/googlemap/Release/ProjectReleases.aspx?ReleaseId=13707
The page indicates version 3.4

3)      I get a render-error when the control is placed inside the tabpanel.
Is that normal?
Screenshot:
http://leflank.dk/error/GoogleMapTabAjaxError2.png


 

I must thank you for all the work. It is a very nice control.

 


Best regard

Flemming Malmkvist

Jul 27, 2008 at 7:07 PM
Hi,

I thought I have fixed that. Seems have to finish it :).
I hope soon to find some time to work on this control, again.
About the version: don't mind it. I just forgot to change it in AssemblyInfo file.

Regards,
Velio
Jul 27, 2008 at 9:03 PM
Thanks, I will be looking for the new version ... :-)
About the render-error..?
Sep 4, 2008 at 3:58 PM
Velio,

I am also seeing these issues with 3.4

Any ideas on what might be causing this? If you can give me some of your ideas, I was going to investigate from there and see if I can get it working. This issue is annoying my users as it makes the map difficult to pan. Thanks.
Sep 11, 2008 at 11:34 AM
Edited Sep 11, 2008 at 11:42 AM

I was to fast for my own good.
This dosen't work.
It did or I thaught it did, but it dosen't.

Sorry.



I have come up with a fix.

 

The key is the checkResize() method.

 

I create a javascript function (resetMap()) that fires on the OnClientClick on the Map tab.

What the resetMap() function dose is tre things.

 

  1. First checks the map center and zoom and stores it in vars.
  2. Then is runs the checkResize()method. 
  3. Last it sets the map center and zoom from the vars.

 

My VB code.

 

 

scriptString = String.Format(  _

" var newLat = {0}.GMap.getCenter().lat(); " + _

" var newLng = {0}.GMap.getCenter().lng(); " + _

" var newZoom = {0}.GMap.getZoom(); " + _

" {0}.checkResize();  " + _

" {0}.GMap.setCenter(new GLatLng(newLat,newLng), newZoom);" _

, Me.googleMap.ClientMapID)

 

Me.Page.ClientScript.RegisterStartupScript(Me.GetType, "reInitMapScript", String.Format("<script type=""text/javascript"">function resetMap (){{{0}}}</script>", scriptString))

 

 

Hope this helps.

 

It can probably be done more neat.

 

Sorry for bad English.

Sep 11, 2008 at 12:00 PM
Okey!

I got it to work. I hade set a 50ms delay on clickevent before the resetMap function.

Me

 

.Page.ClientScript.RegisterStartupScript(Me.GetType, "reInitMapScript", String.Format("<script type=""text/javascript"">function reInitMap(){{setTimeout('resetMap()',50);}}; function resetMap() {{{0}}};</script>", scriptString))

 

Sep 11, 2008 at 2:29 PM
Hi.
I improved the code a bit.

Made a new class that inherits the Artem Google Map control.
This i all you need.


Public

 

Class TabEnabledGoogleMap

 

 

Inherits Artem.Web.UI.Controls.GoogleMap

 

#Region

 

"Properties"

 

 

''' <summary>

 

 

''' The tabPanel the map is contained in.

 

 

''' </summary>

 

 

Private ReadOnly Property tabPanel() As AjaxControlToolkit.TabPanel

 

 

Get

 

 

Dim value As Control = Me.Parent

 

 

While Not value Is Nothing AndAlso TryCast(value, AjaxControlToolkit.TabPanel) Is Nothing

 

value = value.Parent

 

End While

 

 

Return TryCast(value, AjaxControlToolkit.TabPanel)

 

 

End Get

 

 

End Property

 

#End

 

Region

 

#Region

 

"Methods"

 

 

Private Sub addScript(ByVal oldMethod As String)

 

 

Dim scriptString As String

 

scriptString =

String.Format(" var newLat = {0}.GMap.getCenter().lat();{1} var newLng = {0}.GMap.getCenter().lng();{1} var newZoom = {0}.GMap.getZoom();{1} " + _

 

 

" {0}.checkResize();{1} " + _

 

 

" {0}.GMap.setCenter(new GLatLng(newLat,newLng), newZoom);", Me.ClientMapID, vbNewLine)

 

 

If Not String.IsNullOrEmpty(oldMethod) Then

 

oldMethod =

String.Format("{0}();", oldMethod)

 

 

End If

 

 

Me.Page.ClientScript.RegisterStartupScript(Me.GetType, String.Format("_reInitMapScript", Me.ClientID), String.Format("<script type=""text/javascript"">function {2}_reInitMap(){{{1} setTimeout('resetMap()',50);}}; function resetMap() {{{0}}};</script>", scriptString, oldMethod, Me.ClientID))

 

 

End Sub

 

 

Private Sub tabableGoogleMap_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

 

If Not Me.tabPanel Is Nothing Then

 

 

Me.addScript(Me.tabPanel.OnClientClick)

 

 

Me.tabPanel.OnClientClick = String.Format("{0}_reInitMap", Me.ClientID)

 

 

End If

 

 

End Sub

 

#End

 

Region 'Methods"

 

End

 

Class