DataSourceControl.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // System.Web.UI.DataSourceControl
  3. //
  4. // Authors:
  5. // Ben Maurer ([email protected])
  6. //
  7. // (C) 2003 Ben Maurer
  8. //
  9. #if NET_1_2
  10. using System.Collections;
  11. using System.Collections.Specialized;
  12. using System.Text;
  13. namespace System.Web.UI {
  14. public abstract class DataSourceControl : Control, IDataSource, System.ComponentModel.IListSource {
  15. protected DataSourceControl()
  16. {
  17. }
  18. protected override ControlCollection CreateControlCollection ()
  19. {
  20. return new EmptyControlCollection (this);
  21. }
  22. protected virtual DataSourceView GetView (string viewName)
  23. {
  24. return null;
  25. }
  26. DataSourceView IDataSource.GetView (string viewName)
  27. {
  28. return GetView (viewName);
  29. }
  30. protected virtual ICollection GetViewNames ()
  31. {
  32. return null;
  33. }
  34. ICollection IDataSource.GetViewNames ()
  35. {
  36. return GetViewNames ();
  37. }
  38. IList System.ComponentModel.IListSource.GetList ()
  39. {
  40. return ListSourceHelper.GetList (this);
  41. }
  42. bool System.ComponentModel.IListSource.ContainsListCollection {
  43. get { return ListSourceHelper.ContainsListCollection (this); }
  44. }
  45. //public override bool EnablePersonalization { get; set; }
  46. //public override bool EnableTheming { get; set; }
  47. //public override string SkinID { get; set; }
  48. public override bool Visible {
  49. get { return false; }
  50. set { throw new NotSupportedException (); }
  51. }
  52. static object dataSourceChanged = new object ();
  53. event EventHandler System.Web.UI.IDataSource.DataSourceChanged {
  54. add { Events.AddHandler (dataSourceChanged, value); }
  55. remove { Events.RemoveHandler (dataSourceChanged, value); }
  56. }
  57. protected virtual void OnDataSourceChanged (EventArgs e)
  58. {
  59. EventHandler eh = Events [dataSourceChanged] as EventHandler;
  60. if (eh != null)
  61. eh (this, e);
  62. }
  63. }
  64. }
  65. #endif