Code Behind Page Page /Controls/GoogleMapForASPNet.ascx.cs (C#)
Used by Page /Controls/GoogleMapForASPNet.ascx (C#)
1: //   Google Maps User Control for ASP.Net version 1.0:  
2: //   ========================  
3: //   Copyright (C) 2008  Shabdar Ghata    
4: //   Email : ghata2002@gmail.com  
5: //   URL : http://www.shabdar.org  
6:   
7: //   This program is free software: you can redistribute it and/or modify  
8: //   it under the terms of the GNU General Public License as published by  
9: //   the Free Software Foundation, either version 3 of the License, or  
10: //   (at your option) any later version.  
11:   
12: //   This program is distributed in the hope that it will be useful,  
13: //   but WITHOUT ANY WARRANTY; without even the implied warranty of  
14: //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
15: //   GNU General Public License for more details.  
16:   
17: //   You should have received a copy of the GNU General Public License  
18: //   along with this program.  If not, see <http://www.gnu.org/licenses/>.  
19:   
20: //   This program comes with ABSOLUTELY NO WARRANTY.  
21: using System;  
22: using System.Data;  
23: using System.Configuration;  
24: using System.Collections;  
25: using System.Web;  
26: using System.Web.Security;  
27: using System.Web.UI;  
28: using System.Web.UI.WebControls;  
29: using System.Web.UI.WebControls.WebParts;  
30: using System.Web.UI.HtmlControls;  
31: using System.Text;  
32: using System.Drawing;  
33: using System.Web.Services;  
34:   
35: public partial class GoogleMapForASPNet : System.Web.UI.UserControl  
36: {  
37:   
38:     public delegate void PushpinDragHandler(string pID);  
39:     public delegate void PushpinClickedHandler(string pID);  
40:     public delegate void MapClickedHandler(double dLatitude, double dLongitude);  
41:     public delegate void ZoomChangedHandler(int pZoomLevel);  
42:     public event PushpinDragHandler PushpinDrag;  
43:     public event PushpinClickedHandler PushpinClicked;  
44:     public event MapClickedHandler MapClicked;  
45:     public event ZoomChangedHandler ZoomChanged;  
46:     // The method which fires the Event  
47:   
48:     public void OnPushpinDrag(string pID)  
49:     {  
50:         // Check if there are any Subscribers  
51:         if (PushpinDrag != null)  
52:         {  
53:             // Call the Event  
54:             GoogleMapObject = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];  
55:             PushpinDrag(pID);  
56:         }  
57:     }  
58:   
59:     public void OnPushpinClicked(string pID)  
60:     {  
61:         // Check if there are any Subscribers  
62:         if (PushpinClicked != null)  
63:         {  
64:             // Call the Event  
65:             GoogleMapObject = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];  
66:             PushpinClicked(pID);  
67:         }  
68:     }  
69:   
70:     public void OnMapClicked(double dLatitude,double dLongitude)  
71:     {  
72:         // Check if there are any Subscribers  
73:         if (MapClicked != null)  
74:         {  
75:             // Call the Event  
76:             GoogleMapObject = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];  
77:             MapClicked(dLatitude,dLongitude);  
78:         }  
79:     }  
80:   
81:     public void OnZoomChanged(int pZoomLevel)  
82:     {  
83:         // Check if there are any Subscribers  
84:         if (ZoomChanged != null)  
85:         {  
86:             // Call the Event  
87:             GoogleMapObject = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];  
88:             ZoomChanged(pZoomLevel);  
89:         }  
90:     }  
91:   
92:     #region Properties  
93:   
94:     GoogleObject _googlemapobject = new GoogleObject();  
95:     public GoogleObject GoogleMapObject  
96:     {  
97:         get { return _googlemapobject; }  
98:         set { _googlemapobject = value; }  
99:     }  
100:   
101:   
102:     bool _showcontrols = false;  
103:     public bool ShowControls  
104:     {  
105:         get { return _showcontrols; }  
106:         set { _showcontrols = value; }  
107:     }  
108:   
109:   
110:     #endregion  
111:   
112:   
113:     protected void Page_Load(object sender, EventArgs e)  
114:     {  
115:         //Console.Write(hidEventName.Value);  
116:         //Console.Write(hidEventValue.Value);  
117:         //Fire event for Pushpin Move  
118:         if (hidEventName.Value == "MapClicked")  
119:         {  
120:             string[] sLatLng = hidEventValue.Value.Split(new char[] {','}, StringSplitOptions.None);  
121:             if (sLatLng.Length > 0)  
122:             {  
123:                 double dLat = double.Parse(sLatLng[0]);  
124:                 double dLng = double.Parse(sLatLng[1]);  
125:                 //Set event name to blank string, so on next postback same event doesn't fire again.  
126:                 hidEventName.Value = "";  
127:                 OnMapClicked(dLat,dLng);  
128:             }  
129:         }  
130:         if (hidEventName.Value == "PushpinClicked")  
131:         {  
132:             //Set event name to blank string, so on next postback same event doesn't fire again.  
133:             hidEventName.Value = "";  
134:             OnPushpinClicked(hidEventValue.Value);  
135:         }  
136:         if (hidEventName.Value == "PushpinDrag")  
137:         {  
138:             //Set event name to blank string, so on next postback same event doesn't fire again.  
139:             hidEventName.Value = "";  
140:             OnPushpinDrag(hidEventValue.Value);  
141:         }  
142:         if (hidEventName.Value == "ZoomChanged")  
143:         {  
144:             //Set event name to blank string, so on next postback same event doesn't fire again.  
145:             hidEventName.Value = "";  
146:             OnZoomChanged(int.Parse(hidEventValue.Value));  
147:         }  
148:   
149:           
150:         if (!IsPostBack)  
151: There is a limit of 150 source code lines in the evaluation version
152: There is a limit of 150 source code lines in the evaluation version
153: There is a limit of 150 source code lines in the evaluation version
154: There is a limit of 150 source code lines in the evaluation version
155: There is a limit of 150 source code lines in the evaluation version
156: There is a limit of 150 source code lines in the evaluation version
157: There is a limit of 150 source code lines in the evaluation version
158: There is a limit of 150 source code lines in the evaluation version
159: There is a limit of 150 source code lines in the evaluation version
160: There is a limit of 150 source code lines in the evaluation version
161: There is a limit of 150 source code lines in the evaluation version
162: There is a limit of 150 source code lines in the evaluation version
163: There is a limit of 150 source code lines in the evaluation version
164: There is a limit of 150 source code lines in the evaluation version
165: There is a limit of 150 source code lines in the evaluation version
166: There is a limit of 150 source code lines in the evaluation version
167: There is a limit of 150 source code lines in the evaluation version
168: There is a limit of 150 source code lines in the evaluation version
169: There is a limit of 150 source code lines in the evaluation version

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.