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.
31 using System.Collections;
32 using System.Collections.Specialized;
33 using System.ComponentModel;
36 namespace System.Web.UI {
38 [DesignerAttribute ("System.Web.UI.Design.DataSourceDesigner, " + Consts.AssemblySystem_Design,
39 "System.ComponentModel.Design.IDesigner")]
40 [ControlBuilderAttribute (typeof (DataSourceControlBuilder))]
41 [NonVisualControlAttribute]
42 [BindableAttribute (false)]
43 public abstract class DataSourceControl : Control, IDataSource, System.ComponentModel.IListSource {
46 protected DataSourceControl()
50 [MonoTODO ("Not implemented")]
51 [EditorBrowsable (EditorBrowsableState.Never)]
52 public override void ApplyStyleSheetSkin (Page page)
54 throw new NotImplementedException ();
57 protected override ControlCollection CreateControlCollection ()
59 return new EmptyControlCollection (this);
62 [MonoTODO ("why override?")]
63 [EditorBrowsable (EditorBrowsableState.Never)]
64 public override Control FindControl (string id)
66 return base.FindControl (id);
69 [EditorBrowsable (EditorBrowsableState.Never)]
70 public override void Focus ()
72 throw new NotSupportedException ();
75 protected abstract DataSourceView GetView (string viewName);
77 DataSourceView IDataSource.GetView (string viewName)
79 return GetView (viewName);
82 protected virtual ICollection GetViewNames ()
87 ICollection IDataSource.GetViewNames ()
89 return GetViewNames ();
92 IList System.ComponentModel.IListSource.GetList ()
94 return ListSourceHelper.GetList (this);
97 [EditorBrowsable (EditorBrowsableState.Never)]
98 public override bool HasControls ()
100 return base.HasControls ();
103 protected virtual void RaiseDataSourceChangedEvent (EventArgs e)
105 EventHandler eh = Events [dataSourceChanged] as EventHandler;
110 [EditorBrowsable (EditorBrowsableState.Never)]
111 public override void RenderControl (HtmlTextWriter writer)
113 base.RenderControl (writer);
116 [EditorBrowsable (EditorBrowsableState.Never)]
117 public override string ClientID {
118 get { return base.ClientID; }
121 [EditorBrowsable (EditorBrowsableState.Never)]
122 public override ControlCollection Controls {
123 get { return base.Controls; }
126 [DefaultValue (false)]
128 [EditorBrowsable (EditorBrowsableState.Never)]
129 public override bool EnableTheming {
130 get { return false; }
131 set { throw new NotSupportedException (); }
136 [EditorBrowsable (EditorBrowsableState.Never)]
137 public override string SkinID {
138 get { return base.SkinID; }
139 set { base.SkinID = value; }
142 bool System.ComponentModel.IListSource.ContainsListCollection {
143 get { return ListSourceHelper.ContainsListCollection (this); }
147 [EditorBrowsable (EditorBrowsableState.Never)]
148 [DefaultValue (false)]
149 public override bool Visible {
150 get { return false; }
151 set { throw new NotSupportedException (); }
154 static object dataSourceChanged = new object ();
155 event EventHandler System.Web.UI.IDataSource.DataSourceChanged {
156 add { Events.AddHandler (dataSourceChanged, value); }
157 remove { Events.RemoveHandler (dataSourceChanged, value); }