Explorar o código

ChangeLog: Updated.
BaseDataList.cs:
DataBountControl.cs:
Repeater.cs: Added SelectArguments property and updated.
SiteMapDataSourceView.cs:
SqlDataSourceView.cs:
XmlDataSourceView.cs: Removed extra method, which was there to keep
things compiling.


svn path=/trunk/mcs/; revision=36515

Sanja Gupta %!s(int64=21) %!d(string=hai) anos
pai
achega
c07af6cb8a

+ 258 - 250
mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs

@@ -4,10 +4,12 @@
 // Authors:
 //   Gaurav Vaish ([email protected])
 //   Andreas Nahr ([email protected])
+//   Sanjay Gupta ([email protected])
 //
 // (C) Gaurav Vaish (2001)
 // (C) 2003 Andreas Nahr
-//
+// (C) 2004 Novell, Inc. (http://www.novell.com)
+//
 
 //
 // Permission is hereby granted, free of charge, to any person obtaining
@@ -29,161 +31,161 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
-using System;
+
+using System;
 using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.Collections;
-using System.Web;
+using System.ComponentModel.Design;
+using System.Collections;
+using System.Web;
 using System.Web.UI;
-using System.Web.Util;
-
-namespace System.Web.UI.WebControls
-{
-	[DefaultEvent("SelectedIndexChanged")]
-	[DefaultProperty("DataSource")]
-	[Designer("System.Web.UI.Design.WebControls.BaseDataListDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
-	public abstract class BaseDataList: WebControl
-	{
-		private  static readonly object SelectedIndexChangedEvent = new object();
-		internal static string          ItemCountViewStateKey     = "_!ItemCount";
-
-		private DataKeyCollection dataKeys;
-		private object            dataSource;
-
-		public BaseDataList() : base()
-		{
-		}
-
-		public static bool IsBindableType(Type type)
-		{
-			if(type.IsPrimitive || type == typeof(string) || type == typeof(DateTime) || type == typeof(Decimal))
-				return true;
-			return false;
-		}
-
-		public override ControlCollection Controls
-		{
-			get
-			{
-				EnsureChildControls();
-				return base.Controls;
-			}
-		}
-
-		public override void DataBind()
+using System.Web.Util;
+
+namespace System.Web.UI.WebControls
+{
+	[DefaultEvent("SelectedIndexChanged")]
+	[DefaultProperty("DataSource")]
+	[Designer("System.Web.UI.Design.WebControls.BaseDataListDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+	public abstract class BaseDataList: WebControl
+	{
+		private  static readonly object SelectedIndexChangedEvent = new object();
+		internal static string          ItemCountViewStateKey     = "_!ItemCount";
+
+		private DataKeyCollection dataKeys;
+		private object            dataSource;
+
+		public BaseDataList() : base()
+		{
+		}
+
+		public static bool IsBindableType(Type type)
+		{
+			if(type.IsPrimitive || type == typeof(string) || type == typeof(DateTime) || type == typeof(Decimal))
+				return true;
+			return false;
+		}
+
+		public override ControlCollection Controls
+		{
+			get
+			{
+				EnsureChildControls();
+				return base.Controls;
+			}
+		}
+
+		public override void DataBind()
 		{
 			#if NET_2_0
 			RequiresDataBinding = false;
-			#endif
-			OnDataBinding(EventArgs.Empty);
-		}
-
-		[WebCategory("Action")]
-		[WebSysDescription("BaseDataList_OnSelectedIndexChanged")]
-		public event EventHandler SelectedIndexChanged
-		{
-			add
-			{
-				Events.AddHandler(SelectedIndexChangedEvent, value);
-			}
-			remove
-			{
-				Events.RemoveHandler(SelectedIndexChangedEvent, value);
-			}
-		}
-
-		[Bindable(true)]
-		[DefaultValue(-1)]
-		[WebCategory("Layout")]
-		[WebSysDescription("BaseDataList_CellPadding")]
-		public virtual int CellPadding
-		{
-			get
-			{
-				if(!ControlStyleCreated)
-					return -1;
-				return ((TableStyle)ControlStyle).CellPadding;
-			}
-			set
-			{
-				((TableStyle)ControlStyle).CellPadding = value;
-			}
-		}
-
-		[Bindable(true)]
-		[DefaultValue(-1)]
-		[WebCategory("Layout")]
-		[WebSysDescription("BaseDataList_CellSpacing")]
-		public virtual int CellSpacing
-		{
-			get
-			{
-				if(!ControlStyleCreated)
-					return -1;
-				return ((TableStyle)ControlStyle).CellSpacing;
-			}
-			set
-			{
-				((TableStyle)ControlStyle).CellSpacing = value;
-			}
-		}
-
-		[DefaultValue("")]
-		[WebCategory("Data")]
-		[WebSysDescription("BaseDataList_DataKeyField")]
-		public virtual string DataKeyField
-		{
-			get
-			{
-				object o = ViewState["DataKeyField"];
-				if(o!=null)
-					return (string)o;
-				return String.Empty;
-			}
-			set
-			{
-				ViewState["DataKeyField"] = value;
-			}
-		}
-
-		[Browsable(true)]
-		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-		[WebSysDescription("BaseDataList_DataKeys")]
-		public DataKeyCollection DataKeys
-		{
-			get
-			{
-				if( dataKeys==null )
-					dataKeys = new DataKeyCollection(DataKeysArray);
-				return dataKeys;
-
-			}
-		}
-
-		[DefaultValue("")]
-		[WebCategory("Data")]
-		[WebSysDescription("BaseDataList_DataMember")]
-		public string DataMember
-		{
-			get
-			{
-				object o = ViewState["DataMember"];
-				if(o!=null)
-					return (string)o;
-				return String.Empty;
-			}
-			set
-			{
-				ViewState["DataMember"] = value;
-			}
-		}
-
-		[Bindable(true)]
-		[DefaultValue(null)]
-		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-		[WebCategory("Data")]
-		[WebSysDescription("BaseDataList_DataSource")]
+			#endif
+			OnDataBinding(EventArgs.Empty);
+		}
+
+		[WebCategory("Action")]
+		[WebSysDescription("BaseDataList_OnSelectedIndexChanged")]
+		public event EventHandler SelectedIndexChanged
+		{
+			add
+			{
+				Events.AddHandler(SelectedIndexChangedEvent, value);
+			}
+			remove
+			{
+				Events.RemoveHandler(SelectedIndexChangedEvent, value);
+			}
+		}
+
+		[Bindable(true)]
+		[DefaultValue(-1)]
+		[WebCategory("Layout")]
+		[WebSysDescription("BaseDataList_CellPadding")]
+		public virtual int CellPadding
+		{
+			get
+			{
+				if(!ControlStyleCreated)
+					return -1;
+				return ((TableStyle)ControlStyle).CellPadding;
+			}
+			set
+			{
+				((TableStyle)ControlStyle).CellPadding = value;
+			}
+		}
+
+		[Bindable(true)]
+		[DefaultValue(-1)]
+		[WebCategory("Layout")]
+		[WebSysDescription("BaseDataList_CellSpacing")]
+		public virtual int CellSpacing
+		{
+			get
+			{
+				if(!ControlStyleCreated)
+					return -1;
+				return ((TableStyle)ControlStyle).CellSpacing;
+			}
+			set
+			{
+				((TableStyle)ControlStyle).CellSpacing = value;
+			}
+		}
+
+		[DefaultValue("")]
+		[WebCategory("Data")]
+		[WebSysDescription("BaseDataList_DataKeyField")]
+		public virtual string DataKeyField
+		{
+			get
+			{
+				object o = ViewState["DataKeyField"];
+				if(o!=null)
+					return (string)o;
+				return String.Empty;
+			}
+			set
+			{
+				ViewState["DataKeyField"] = value;
+			}
+		}
+
+		[Browsable(true)]
+		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+		[WebSysDescription("BaseDataList_DataKeys")]
+		public DataKeyCollection DataKeys
+		{
+			get
+			{
+				if( dataKeys==null )
+					dataKeys = new DataKeyCollection(DataKeysArray);
+				return dataKeys;
+
+			}
+		}
+
+		[DefaultValue("")]
+		[WebCategory("Data")]
+		[WebSysDescription("BaseDataList_DataMember")]
+		public string DataMember
+		{
+			get
+			{
+				object o = ViewState["DataMember"];
+				if(o!=null)
+					return (string)o;
+				return String.Empty;
+			}
+			set
+			{
+				ViewState["DataMember"] = value;
+			}
+		}
+
+		[Bindable(true)]
+		[DefaultValue(null)]
+		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+		[WebCategory("Data")]
+		[WebSysDescription("BaseDataList_DataSource")]
 		public virtual object DataSource {
 			get {
 				return dataSource;
@@ -198,101 +200,101 @@ namespace System.Web.UI.WebControls
 			}
 		}
 
-		[Bindable(true)]
-		[DefaultValue(GridLines.Both)]
-		[WebCategory("Appearance")]
-		[WebSysDescription("BaseDataList_GridLines")]
-		public virtual GridLines GridLines
-		{
-			get
-			{
-				if(ControlStyleCreated)
-					return ((TableStyle)ControlStyle).GridLines;
-				return GridLines.Both;
-			}
-			set
-			{
-				((TableStyle)ControlStyle).GridLines = value;
-			}
+		[Bindable(true)]
+		[DefaultValue(GridLines.Both)]
+		[WebCategory("Appearance")]
+		[WebSysDescription("BaseDataList_GridLines")]
+		public virtual GridLines GridLines
+		{
+			get
+			{
+				if(ControlStyleCreated)
+					return ((TableStyle)ControlStyle).GridLines;
+				return GridLines.Both;
+			}
+			set
+			{
+				((TableStyle)ControlStyle).GridLines = value;
+			}
 		}
 
 		// LAMESPEC HorizontalAlign has a Category attribute, this should obviously be a WebCategory attribute
-		// but is defined incorrectly in the MS framework
-
-		[Bindable(true)]
-		[DefaultValue(HorizontalAlign.NotSet)]
-		[Category("Layout")]
-		[WebSysDescription("BaseDataList_HorizontalAlign")]
-		public virtual HorizontalAlign HorizontalAlign
-		{
-			get
-			{
-				if(ControlStyleCreated)
-					return ((TableStyle)ControlStyle).HorizontalAlign;
-				return HorizontalAlign.NotSet;
-			}
-			set
-			{
-				((TableStyle)ControlStyle).HorizontalAlign = value;
-			}
-		}
-
-		protected ArrayList DataKeysArray
-		{
-			get
-			{
-				object o = ViewState["DataKeys"];
-				if(o == null)
-				{
-					o = new ArrayList();
-					ViewState["DataKeys"] = o;
-				}
-				return (ArrayList)o;
-			}
-		}
-
-		protected override void AddParsedSubObject(object o)
-		{
-			// Preventing literal controls from being added as children.
-		}
-
-		protected override void CreateChildControls()
-		{
-			Controls.Clear();
-			if(ViewState[ItemCountViewStateKey]!=null)
-			{
-				CreateControlHierarchy(false);
-				ClearChildViewState();
-			}
-		}
-
-		protected override void OnDataBinding(EventArgs e)
-		{
-			base.OnDataBinding(e);
-			Controls.Clear();
-			ClearChildViewState();
-			CreateControlHierarchy(true);
-			ChildControlsCreated = true;
-			TrackViewState();
-		}
-
-		protected virtual void OnSelectedIndexChanged(EventArgs e)
-		{
-			if(Events != null)
-			{
-				EventHandler eh = (EventHandler)(Events[SelectedIndexChangedEvent]);
-				if(eh!=null)
-					eh(this, e);
-			}
-		}
-
-		protected override void Render(HtmlTextWriter writer)
-		{
-			PrepareControlHierarchy();
-			RenderContents(writer);
-		}
-
-		protected abstract void PrepareControlHierarchy();
+		// but is defined incorrectly in the MS framework
+
+		[Bindable(true)]
+		[DefaultValue(HorizontalAlign.NotSet)]
+		[Category("Layout")]
+		[WebSysDescription("BaseDataList_HorizontalAlign")]
+		public virtual HorizontalAlign HorizontalAlign
+		{
+			get
+			{
+				if(ControlStyleCreated)
+					return ((TableStyle)ControlStyle).HorizontalAlign;
+				return HorizontalAlign.NotSet;
+			}
+			set
+			{
+				((TableStyle)ControlStyle).HorizontalAlign = value;
+			}
+		}
+
+		protected ArrayList DataKeysArray
+		{
+			get
+			{
+				object o = ViewState["DataKeys"];
+				if(o == null)
+				{
+					o = new ArrayList();
+					ViewState["DataKeys"] = o;
+				}
+				return (ArrayList)o;
+			}
+		}
+
+		protected override void AddParsedSubObject(object o)
+		{
+			// Preventing literal controls from being added as children.
+		}
+
+		protected override void CreateChildControls()
+		{
+			Controls.Clear();
+			if(ViewState[ItemCountViewStateKey]!=null)
+			{
+				CreateControlHierarchy(false);
+				ClearChildViewState();
+			}
+		}
+
+		protected override void OnDataBinding(EventArgs e)
+		{
+			base.OnDataBinding(e);
+			Controls.Clear();
+			ClearChildViewState();
+			CreateControlHierarchy(true);
+			ChildControlsCreated = true;
+			TrackViewState();
+		}
+
+		protected virtual void OnSelectedIndexChanged(EventArgs e)
+		{
+			if(Events != null)
+			{
+				EventHandler eh = (EventHandler)(Events[SelectedIndexChangedEvent]);
+				if(eh!=null)
+					eh(this, e);
+			}
+		}
+
+		protected override void Render(HtmlTextWriter writer)
+		{
+			PrepareControlHierarchy();
+			RenderContents(writer);
+		}
+
+		protected abstract void PrepareControlHierarchy();
 		protected abstract void CreateControlHierarchy(bool useDataSource);
 		
 		#if NET_2_0
@@ -343,9 +345,10 @@ namespace System.Web.UI.WebControls
 				if (DataSource != null && DataSourceID != "")
 					throw new HttpException ();
 				
-				IDataSource ds = this.GetDataSourceObject () as IDataSource;
-				if (ds != null && DataSourceID != "")
-					return ds.GetView (DataMember).Select ();
+				IDataSource ds = this.GetDataSourceObject () as IDataSource;				
+				if (ds != null && DataSourceID != "") {					
+					return ds.GetView (DataMember).ExecuteSelect (selectArguments); 
+				}
 				else if (DataSource != null)
 					return DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
 				else
@@ -380,7 +383,12 @@ namespace System.Web.UI.WebControls
 			}
 			
 			protected bool inited;
-				
+			
+			DataSourceSelectArguments selectArguments = null;
+			
+			protected DataSourceSelectArguments SelectArguments {
+				get { return selectArguments; }
+			}				
 		#else
 			internal IEnumerable GetResolvedDataSource ()
 			{
@@ -389,6 +397,6 @@ namespace System.Web.UI.WebControls
 				else
 					return null; 
 			}
-		#endif
-	}
-}
+		#endif
+	}
+}

+ 10 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,13 @@
+2004-11-25 Sanjay Gupta <[email protected]>
+
+	* BaseDataList.cs: 
+	* DataBountControl.cs:
+	* Repeater.cs: Added SelectArguments property and updated.
+	* SiteMapDataSourceView.cs:
+	* SqlDataSourceView.cs:
+	* XmlDataSourceView.cs: Removed extra method, which was there to
+				keep things compiling.
+
 2004-11-23 Lluis Sanchez Gual <[email protected]>
 
 	* TreeNodeBindingCollection.cs, TreeNodeBinding.cs, TreeNode.cs,

+ 9 - 1
mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs

@@ -3,8 +3,10 @@
 //
 // Authors:
 //	Ben Maurer ([email protected])
+//	Sanjay Gupta ([email protected])
 //
 // (C) 2003 Ben Maurer
+// (C) 2004 Novell, Inc. (http://www.novell.com)
 //
 
 //
@@ -73,7 +75,7 @@ namespace System.Web.UI.WebControls {
 			
 			IDataSource ds = GetDataSourceObject () as IDataSource;
 			if (ds != null && DataSourceID != "")
-				return ds.GetView (DataMember).Select ();
+				return ds.GetView (DataMember).ExecuteSelect (selectArguments);
 			else if (DataSource != null)
 				return DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
 			else
@@ -188,6 +190,12 @@ namespace System.Web.UI.WebControls {
 		}
 		
 		protected bool inited;
+		
+		DataSourceSelectArguments selectArguments = null;
+			
+		protected DataSourceSelectArguments SelectArguments {
+			get { return selectArguments; }
+		}
 	}
 }
 #endif

+ 9 - 1
mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs

@@ -5,10 +5,12 @@
 //   Gaurav Vaish ([email protected])
 //   Gonzalo Paniagua Javier ([email protected])
 //   Andreas Nahr ([email protected])
+//   Sanjay Gupta ([email protected])
 //
 // (c) 2002 Ximian, Inc. (http://www.ximian.com)
 // (C) Gaurav Vaish (2002)
 // (C) 2003 Andreas Nahr
+// (C) 2004 Novell, Inc. (http://www.novell.com)
 //
 
 //
@@ -487,7 +489,7 @@ namespace System.Web.UI.WebControls
 				
 				IDataSource ds = this.GetDataSourceObject () as IDataSource;
 				if (ds != null && DataSourceID != "")
-					return ds.GetView (DataMember).Select ();
+					return ds.GetView (DataMember).ExecuteSelect (selectArguments);
 				else if (DataSource != null)
 					return DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
 				else
@@ -522,6 +524,12 @@ namespace System.Web.UI.WebControls
 			}
 			
 			protected bool inited;
+
+			DataSourceSelectArguments selectArguments = null;
+	
+			protected DataSourceSelectArguments SelectArguments {
+				get { return selectArguments; }
+			}
 				
 		#else
 			IEnumerable GetResolvedDataSource ()

+ 0 - 6
mcs/class/System.Web/System.Web.UI.WebControls/SiteMapDataSourceView.cs

@@ -59,12 +59,6 @@ namespace System.Web.UI.WebControls {
 			throw new NotImplementedException ();
 		}
 		
-		[MonoTODO ("Extra method to keep things compiling, need to remove later")]
-		public override IEnumerable Select ()
-		{
-			throw new NotImplementedException ();
-		}
-
 		SiteMapNodeCollection collection;
 		string viewName;
 		SiteMapDataSource owner;

+ 0 - 6
mcs/class/System.Web/System.Web.UI.WebControls/SqlDataSourceView.cs

@@ -117,12 +117,6 @@ namespace System.Web.UI.WebControls {
 			return ExecuteSelect (arguments);
 		}
 
-		[MonoTODO("Extra method to keep things compiling, need to remove later")]
-		public override IEnumerable Select()
-		{
-			throw new NotImplementedException ("Not required");
-		}
-
 		[MonoTODO ("Handle arguments")]
 		protected internal override IEnumerable ExecuteSelect (
 						DataSourceSelectArguments arguments)

+ 1 - 7
mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSourceView.cs

@@ -66,13 +66,7 @@ namespace System.Web.UI.WebControls {
 						DataSourceSelectArguments arguments)
 		{
 			throw new NotImplementedException ();
-		}
-		
-		[MonoTODO ("Extra method to keep things compiling, need to remove later")]
-		public override IEnumerable Select ()
-		{
-			throw new NotImplementedException ();
-		}
+		}		
 	}
 }
 #endif