[CLOSED] Adding Google Marker From Code Behind

  1. #1

    [CLOSED] Adding Google Marker From Code Behind

    I am trying to add some google markers from code behind with additional method AddMarkers at GMapPanel.cs

    [Meta]
    [Description("")]
    public virtual void AddMarkers(MarkerCollection mc)
    {
           this.Call("addMarkers", mc);
    }
    and then from example.cs, i adding these lines at page_load

    protected void Page_Load(object sender, EventArgs e)
            {
                if (!X.IsAjaxRequest)
                {
                    Marker m = new Marker();
                    m.Lat = 10.1;
                    m.Lng = 10.2;
                    m.Listeners.Click.Handler = "Ext.Msg.alert('Confirm', String.format('You Clicked {0}', el.id));";
    
                    MarkerCollection mc = new MarkerCollection();
                    mc.Add(m);
    
                    CenterMap.AddMarkers(mc);
                }
            }
    And my page raise a JsonSerializationException: error Error getting value from 'InnerHtml' on 'System.Web.UI.HtmlControls.HtmlHead'. I think i need to convert mc into json but i don't know how to do.. Please help for this problem
    Last edited by Daniil; Jun 16, 2011 at 9:40 AM. Reason: [CLOSED]
  2. #2
    Hi,

    You should be able to just populate .Markers collection.
    GMapPanel1.Markers.Add(marker);
  3. #3
    Yes, thank a lot. It is so simple :)
  4. #4
    Quote Originally Posted by Daniil View Post
    Hi,

    You should be able to just populate .Markers collection.
    GMapPanel1.Markers.Add(marker);
    I'm sorry to reopen this thread. Using
    GMapPanel1.Markers.Add(marker);
    only works when it is in page_load. My intention is also to create a marker from any other method such as directevents. Is it possible?
  5. #5
    Forget it, i've found the solution..
  6. #6

    Solution

    Hi,
    I have the same problem.
    Can you describe that how you managed to solve this problem?
    Thank you!
  7. #7
    Quote Originally Posted by dev View Post
    Forget it, i've found the solution..
    Hi,
    I have the same problem.
    Can you describe that how you managed to solve this problem?
    Thank you!

Similar Threads

  1. hide marker on by ID
    By sedoyksa in forum 1.x Help
    Replies: 1
    Last Post: Nov 21, 2011, 6:09 PM
  2. [CLOSED] Adding Google Marker with mouse
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 22, 2011, 1:30 PM
  3. svn source project - from code.google.com
    By vs.mukesh in forum 1.x Help
    Replies: 0
    Last Post: Jun 08, 2010, 5:21 PM
  4. How to Adding Google Maps in Panel or Window
    By anderpass in forum 1.x Help
    Replies: 3
    Last Post: Nov 06, 2009, 11:43 AM
  5. Replies: 0
    Last Post: Oct 19, 2009, 6:52 AM

Tags for this Thread

Posting Permissions