Reimers.dk

.NET, AJAX and Google APIs brought together
Welcome to Reimers.dk Sign in | Join | Help
in Search

How can I trigger a server side event on client side programmatically?

Last post 03-12-2009, 17:52 by chuxuanhy. 0 replies.
Sort Posts: Previous Next
  •  03-12-2009, 17:52 2375

    How can I trigger a server side event on client side programmatically?

    Hi everyone,

    Is there anyway to trigger the MoveEnd even with condition on Client Side? The following is my scenario. I do not want to trigger the MoveEnd even every time I do drag and drop the Google Map. I just want to trigger it after the Google Map is dragged and dropped some times. I make a if ... else condition with ClientSideHandler.MoveEnd event to check if the center point ( at the end of ClientSideHandler.MoveEnd ) is outside the Bound of the Map at the first time the Map is loaded. Then, if it is outside, get the Bound value again and trigger the Move End Server Side. Please read the following :

        protected void Page_Load(object sender, EventArgs e)
          {
              Page.Title = "Just for test";

                if (!Page.IsPostBack)
                {
                    GMap.MapControls.Add(new Reimers.Map.Controls.GoogleLargeMapControl("glmc"));
                    GMap.MapControls.Add(new Reimers.Map.Controls.GoogleNormalMapTypeControl("gnmtc"));

                    string com = "point =" + GMap.GetCenter();
                    com += "if(!bound.contains(point)){bound = "+GMap.GetBounds()+";alert('Trigger MoveEnd Event Server Side!')}";
                GMap.ClientSideHandlers.OnMoveEnd = com;  
                }  
            }

            protected void GMap_MoveEnd(object sender, BoundsEventArgs e)
            {
                
            }

          protected void GMap_MapLoaded(object sender, BoundsEventArgs e)
            {
                string com = "bound = " + GMap.GetBounds();
                e.MapCommand = com;
            }

    2/ Jacob, please check the initial Google Map Control markup. It always generate this error after it is initialized and get some property modified.

    "Generation of designer file failed: System.Collections.Generic.List`1[[Reimers.Map.CustomMaps.GoogleMapType, GoogleMap, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null]] must have items of type 'Reimers.Map.CustomMaps.GoogleMapType'. 'Reimers.Map.CustomMaps.GoogleNormalMap' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.    C:\Users\Mr.Tran\Documents\Visual Studio 2008\Projects\WebApplication1\WebApplication1\WebForm1.aspx    21    0    WebApplication1"

View as RSS news feed in XML