Anonymous user  |  Log in  |  Create Account


To be able to use the Store class, it is essential to activate the "enableStore" property.

Store is a very powerful feature, that allows us to share information between client, server and serverEvents.

It works as a Dictionary<string, string>, with a "key" and a "value".

In the sample, we can see how store is used in Javascript (client event), in a serverEvent and in ASP.NET:

  • Javascript: the Store object can be created like this: var store = new Store('{0}_Store'); We can do a "Set(key, value)" y un "Get(Key)" over the store variable. Is usually used in client events. 
  • serverEvents: in a serverEvent, the GAjaxServerEventArgs contains, that is a nomal Dictionary<string, string> from ASP.NET. 
  • ASP.NET: each GMap instance has the Store property, which can be used anytime we want at server's side (however the is advisable to use inside the serverEvent).

<cc1:GMap ID="GMap1" runat="server" enableServerEvents="true" enableStore="true" OnClick="GMap_Click" serverEventsType="AspNetPostBack" />
<br />
<cc1:GMap ID="GMap2" runat="server" enableServerEvents="true" enableStore="true" OnClick="GMap_Click" />
private static int _i;

public static int Next
    get { return _i++; }

protected void Page_Load(object sender, EventArgs e)
    if (!Page.IsPostBack)
        Page.Title = "Google Maps ASP.NET - " + lt_Titulo.Text;

        GMap2.Add(new GListener(GMap2.GMap_Id, GListener.Event.zoomend, string.Format(
                function(oldZoom, newZoom)
                    var store = new Store('{0}_Store');
                    store.Set(Math.random(), oldZoom + '-' + newZoom);
                ", GMap2.GMap_Id)));

        GMap2.Add(new GControl(GControl.preBuilt.SmallZoomControl));

    GMap1.Store.Add(Next.ToString(), DateTime.Now.ToString());

protected string GMap_Click(object s, GAjaxServerEventArgs e)
{[Next.ToString()] = DateTime.Now.ToString();
    return string.Format("alert('{0} Store items: {1}')",,;
Powered by Subgurim.NET