PageRenderTime 102ms CodeModel.GetById 41ms app.highlight 2ms RepoModel.GetById 58ms app.codeStats 0ms

/Artem.GoogleMap.Extensions/GoogleMarkersExtender.cs

#
C# | 70 lines | 39 code | 11 blank | 20 comment | 0 complexity | f0873e4bf548782dd90b110f573819fd MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.ComponentModel;
 4using System.Configuration;
 5using System.Linq;
 6using System.Web;
 7using System.Web.Security;
 8using System.Web.UI;
 9using System.Web.UI.HtmlControls;
10using System.Web.UI.WebControls;
11using System.Web.UI.WebControls.WebParts;
12using System.Xml.Linq;
13
14#region Resources
15[assembly: WebResource("Artem.Google.UI.GoogleMarkersBehavior.js", "text/javascript")] 
16#endregion
17namespace Artem.Google.UI {
18
19    /// <summary>
20    /// Summary description for GoogleMarkersExtender
21    /// </summary>
22    [TargetControlType(typeof(GoogleMap))]
23    public class GoogleMarkersExtender : ExtenderControl {
24
25        #region Properties  ///////////////////////////////////////////////////////////////////////
26
27        [DefaultValue("")]
28        public string ServiceMethod { get; set; }
29
30        [UrlProperty]
31        public string ServicePath { get; set; }
32
33        #endregion
34
35        #region Construct /////////////////////////////////////////////////////////////////////////
36
37        /// <summary>
38        /// Initializes a new instance of the <see cref="GoogleMarkersExtender"/> class.
39        /// </summary>
40        public GoogleMarkersExtender() {
41        } 
42        #endregion
43
44        #region Methods ///////////////////////////////////////////////////////////////////////////
45
46        /// <summary>
47        /// When overridden in a derived class, registers the <see cref="T:System.Web.UI.ScriptDescriptor"/> objects for the control.
48        /// </summary>
49        /// <param name="targetControl">The server control to which the extender is associated.</param>
50        /// <returns>
51        /// An enumeration of <see cref="T:System.Web.UI.ScriptDescriptor"/> objects.
52        /// </returns>
53        protected override IEnumerable<ScriptDescriptor> GetScriptDescriptors(System.Web.UI.Control targetControl) {
54            ScriptBehaviorDescriptor descriptor = new ScriptBehaviorDescriptor("Artem.Google.GoogleMarkersBehavior", targetControl.ClientID);
55            yield return descriptor;
56        }
57
58        // Generate the script reference
59        /// <summary>
60        /// When overridden in a derived class, registers the script libraries for the control.
61        /// </summary>
62        /// <returns>
63        /// An object that implements the <see cref="T:System.Collections.IEnumerable"/> interface and that contains ECMAScript (JavaScript) files that have been registered as embedded resources.
64        /// </returns>
65        protected override IEnumerable<ScriptReference>GetScriptReferences() {
66            yield return new ScriptReference("Artem.Google.UI.GoogleMarkersBehavior.js", this.GetType().Assembly.FullName);
67        } 
68        #endregion
69    }
70}