2 // System.Web.UI.DataSourceControl
5 // Ben Maurer (bmaurer@users.sourceforge.net)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.Collections;
33 using System.Collections.Specialized;
34 using System.ComponentModel;
37 namespace System.Web.UI {
39 [DesignerAttribute ("System.Web.UI.Design.DataSourceDesigner, " + Consts.AssemblySystem_Design,
40 "System.ComponentModel.Design.IDesigner")]
41 [ControlBuilderAttribute (typeof (DataSourceControlBuilder))]
42 [NonVisualControlAttribute]
43 [BindableAttribute (false)]
44 public abstract class DataSourceControl : Control, IDataSource, System.ComponentModel.IListSource {
47 protected DataSourceControl()
51 [MonoTODO ("Not implemented")]
52 [EditorBrowsable (EditorBrowsableState.Never)]
53 public override void ApplyStyleSheetSkin (Page page)
55 throw new NotImplementedException ();
58 protected override ControlCollection CreateControlCollection ()
60 return new EmptyControlCollection (this);
63 [MonoTODO ("why override?")]
64 [EditorBrowsable (EditorBrowsableState.Never)]
65 public override Control FindControl (string id)
67 return base.FindControl (id);
70 [EditorBrowsable (EditorBrowsableState.Never)]
71 public override void Focus ()
73 throw new NotSupportedException ();
76 protected abstract DataSourceView GetView (string viewName);
78 DataSourceView IDataSource.GetView (string viewName)
80 return GetView (viewName);
83 protected virtual ICollection GetViewNames ()
88 ICollection IDataSource.GetViewNames ()
90 return GetViewNames ();
93 IList System.ComponentModel.IListSource.GetList ()
95 return ListSourceHelper.GetList (this);
98 [EditorBrowsable (EditorBrowsableState.Never)]
99 public override bool HasControls ()
101 return base.HasControls ();
104 protected virtual void RaiseDataSourceChangedEvent (EventArgs e)
106 EventHandler eh = Events [dataSourceChanged] as EventHandler;
111 [EditorBrowsable (EditorBrowsableState.Never)]
112 public override void RenderControl (HtmlTextWriter tw)
114 base.RenderControl (tw);
117 [EditorBrowsable (EditorBrowsableState.Never)]
118 public override string ClientID {
119 get { return base.ClientID; }
122 [EditorBrowsable (EditorBrowsableState.Never)]
123 public override ControlCollection Controls {
124 get { return base.Controls; }
127 [DefaultValue (false)]
129 [EditorBrowsable (EditorBrowsableState.Never)]
130 public override bool EnableTheming {
131 get { return false; }
132 set { throw new NotSupportedException (); }
137 [EditorBrowsable (EditorBrowsableState.Never)]
138 public override string SkinID {
139 get { return base.SkinID; }
140 set { base.SkinID = value; }
143 bool System.ComponentModel.IListSource.ContainsListCollection {
144 get { return ListSourceHelper.ContainsListCollection (this); }
148 [EditorBrowsable (EditorBrowsableState.Never)]
149 [DefaultValue (false)]
150 public override bool Visible {
151 get { return false; }
152 set { throw new NotSupportedException (); }
155 static object dataSourceChanged = new object ();
156 event EventHandler System.Web.UI.IDataSource.DataSourceChanged {
157 add { Events.AddHandler (dataSourceChanged, value); }
158 remove { Events.RemoveHandler (dataSourceChanged, value); }