Просмотр исходного кода

2008-05-08 Marek Habersack <[email protected]>

	* DataPager.cs, DataPager.cs, DataPagerFieldCollection.cs,
	DataPagerFieldCommandEventArgs.cs, DataPagerField.cs,
	DataPagerFieldItem.cs, InsertItemPosition.cs,
	IPageableItemContainer.cs, ListViewCancelEventArgs.cs,
	ListViewCancelMode.cs, ListViewCommandEventArgs.cs, ListView.cs,
	ListViewDataItem.cs, ListViewDeletedEventArgs.cs,
	ListViewDeleteEventArgs.cs, ListViewEditEventArgs.cs,
	ListViewInsertedEventArgs.cs, ListViewInsertEventArgs.cs,
	ListViewItem.cs, ListViewItemEventArgs.cs, ListViewItemType.cs,
	ListViewPagedDataSource.cs, ListViewSelectEventArgs.cs,
	ListViewSortEventArgs.cs, ListViewTableRow.cs,
	ListViewUpdatedEventArgs.cs, ListViewUpdateEventArgs.cs,
	NextPreviousPagerField.cs, NumericPagerField.cs, PageEventArgs.cs,
	PagePropertiesChangingEventArgs.cs, TemplatePagerField.cs:
	added. NOTE: this is code in progress! It is not fully implemented
	and usable, please do not file bug reports for the code - patches
	are gladly accepted :)

svn path=/trunk/mcs/; revision=102821
Marek Habersack 17 лет назад
Родитель
Сommit
c254be099a
33 измененных файлов с 4088 добавлено и 1 удалено
  1. 31 1
      mcs/class/System.Web.Extensions/System.Web.Extensions.dll.sources
  2. 20 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ChangeLog
  3. 461 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/DataPager.cs
  4. 196 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/DataPagerField.cs
  5. 122 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/DataPagerFieldCollection.cs
  6. 62 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/DataPagerFieldCommandEventArgs.cs
  7. 66 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/DataPagerFieldItem.cs
  8. 50 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/IPageableItemContainer.cs
  9. 40 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/InsertItemPosition.cs
  10. 1112 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListView.cs
  11. 51 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewCancelEventArgs.cs
  12. 39 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewCancelMode.cs
  13. 51 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewCommandEventArgs.cs
  14. 65 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewDataItem.cs
  15. 56 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewDeleteEventArgs.cs
  16. 64 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewDeletedEventArgs.cs
  17. 47 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewEditEventArgs.cs
  18. 54 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewInsertEventArgs.cs
  19. 78 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewInsertedEventArgs.cs
  20. 60 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewItem.cs
  21. 46 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewItemEventArgs.cs
  22. 40 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewItemType.cs
  23. 159 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewPagedDataSource.cs
  24. 48 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewSelectEventArgs.cs
  25. 53 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewSortEventArgs.cs
  26. 50 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewTableRow.cs
  27. 60 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewUpdateEventArgs.cs
  28. 69 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewUpdatedEventArgs.cs
  29. 508 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/NextPreviousPagerField.cs
  30. 165 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/NumericPagerField.cs
  31. 66 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/PageEventArgs.cs
  32. 50 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/PagePropertiesChangingEventArgs.cs
  33. 49 0
      mcs/class/System.Web.Extensions/System.Web.UI.WebControls/TemplatePagerField.cs

+ 31 - 1
mcs/class/System.Web.Extensions/System.Web.Extensions.dll.sources

@@ -81,4 +81,34 @@
 ./System.Web.UI/RegisteredExpandoAttribute.cs
 ./System.Web.UI/RegisteredHiddenField.cs
 ./System.Web.UI/RegisteredScript.cs
-./System.Web.UI/RegisteredScriptType.cs
+./System.Web.UI/RegisteredScriptType.cs
+./System.Web.UI.WebControls/DataPager.cs
+./System.Web.UI.WebControls/DataPagerFieldCollection.cs
+./System.Web.UI.WebControls/DataPagerFieldCommandEventArgs.cs
+./System.Web.UI.WebControls/DataPagerField.cs
+./System.Web.UI.WebControls/DataPagerFieldItem.cs
+./System.Web.UI.WebControls/InsertItemPosition.cs
+./System.Web.UI.WebControls/IPageableItemContainer.cs
+./System.Web.UI.WebControls/ListViewCancelEventArgs.cs
+./System.Web.UI.WebControls/ListViewCancelMode.cs
+./System.Web.UI.WebControls/ListViewCommandEventArgs.cs
+./System.Web.UI.WebControls/ListView.cs
+./System.Web.UI.WebControls/ListViewDataItem.cs
+./System.Web.UI.WebControls/ListViewDeletedEventArgs.cs
+./System.Web.UI.WebControls/ListViewDeleteEventArgs.cs
+./System.Web.UI.WebControls/ListViewEditEventArgs.cs
+./System.Web.UI.WebControls/ListViewInsertedEventArgs.cs
+./System.Web.UI.WebControls/ListViewInsertEventArgs.cs
+./System.Web.UI.WebControls/ListViewItem.cs
+./System.Web.UI.WebControls/ListViewItemEventArgs.cs
+./System.Web.UI.WebControls/ListViewItemType.cs
+./System.Web.UI.WebControls/ListViewPagedDataSource.cs
+./System.Web.UI.WebControls/ListViewSelectEventArgs.cs
+./System.Web.UI.WebControls/ListViewSortEventArgs.cs
+./System.Web.UI.WebControls/ListViewTableRow.cs
+./System.Web.UI.WebControls/ListViewUpdatedEventArgs.cs
+./System.Web.UI.WebControls/ListViewUpdateEventArgs.cs
+./System.Web.UI.WebControls/NextPreviousPagerField.cs
+./System.Web.UI.WebControls/NumericPagerField.cs
+./System.Web.UI.WebControls/PageEventArgs.cs
+./System.Web.UI.WebControls/PagePropertiesChangingEventArgs.cs

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

@@ -0,0 +1,20 @@
+2008-05-08  Marek Habersack  <[email protected]>
+
+	* DataPager.cs, DataPager.cs, DataPagerFieldCollection.cs,
+	DataPagerFieldCommandEventArgs.cs, DataPagerField.cs,
+	DataPagerFieldItem.cs, InsertItemPosition.cs,
+	IPageableItemContainer.cs, ListViewCancelEventArgs.cs,
+	ListViewCancelMode.cs, ListViewCommandEventArgs.cs, ListView.cs,
+	ListViewDataItem.cs, ListViewDeletedEventArgs.cs,
+	ListViewDeleteEventArgs.cs, ListViewEditEventArgs.cs,
+	ListViewInsertedEventArgs.cs, ListViewInsertEventArgs.cs,
+	ListViewItem.cs, ListViewItemEventArgs.cs, ListViewItemType.cs,
+	ListViewPagedDataSource.cs, ListViewSelectEventArgs.cs,
+	ListViewSortEventArgs.cs, ListViewTableRow.cs,
+	ListViewUpdatedEventArgs.cs, ListViewUpdateEventArgs.cs,
+	NextPreviousPagerField.cs, NumericPagerField.cs, PageEventArgs.cs,
+	PagePropertiesChangingEventArgs.cs, TemplatePagerField.cs:
+	added. NOTE: this is code in progress! It is not fully implemented
+	and usable, please do not file bug reports for the code - patches
+	are gladly accepted :)
+

+ 461 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/DataPager.cs

@@ -0,0 +1,461 @@
+//
+// System.Web.UI.WebControls.DataPager
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+	[ThemeableAttribute(true)]
+	[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	public class DataPager : Control, IAttributeAccessor, INamingContainer, ICompositeControlDesignerAccessor
+	{
+		const int NO_PAGEABLE_ITEM_CONTAINER = 0;
+		const int NO_DATABOUND_CONTROL = 1;
+		const int NO_PAGED_CONTAINER_ID = 2;
+		const int CONTROL_NOT_PAGEABLE = 3;
+		const int NO_NAMING_CONTAINER = 4;
+
+		const int STATE_BASE_STATE = 0;
+		const int STATE_TOTAL_ROW_COUNT = 1;
+		const int STATE_MAXIMUM_ROWS = 2;
+		const int STATE_START_ROW_INDEX = 3;
+		
+		string[] _exceptionMessages = {
+			"No IPageableItemContainer was found. Verify that either the DataPager is inside an IPageableItemContainer or PagedControlID is set to the control ID of an IPageableItemContainer",
+			"There is no data-bound control associated with the DataPager control.",
+			"Control with id '{0}' cannot be found in the page",
+			"Control '{0}' is not pageable",
+			"DataPager has no naming container"
+		};
+		
+		IPageableItemContainer _pageableContainer;
+		DataPagerFieldCollection _fields;
+		AttributeCollection _attributes;
+		
+		int _totalRowCount;
+		int _startRowIndex;
+		int _maximumRows = 10;
+		
+		bool _initDone;
+		bool _needNewContainerSetup = true;
+		bool _createPagerFieldsRunning;
+		
+		public DataPager()
+		{
+			_fields = new DataPagerFieldCollection (this);
+		}
+
+		protected virtual void AddAttributesToRender (HtmlTextWriter writer)
+		{
+			if (ID != null)
+				writer.AddAttribute (HtmlTextWriterAttribute.Id, ID);
+
+			if (_attributes != null && _attributes.Count > 0) {
+				foreach (string attr in _attributes.Keys)
+					writer.AddAttribute (attr, _attributes [attr]);
+			}
+		}
+
+		protected virtual void ConnectToEvents (IPageableItemContainer container)
+		{
+			if (container == null)
+				throw new ArgumentNullException ("container");
+
+			container.TotalRowCountAvailable += new EventHandler <PageEventArgs> (OnTotalRowCountAvailable);
+		}
+
+		protected virtual void CreatePagerFields ()
+		{
+			// In theory (on multi-core or SMP machines), OnTotalRowCountAvailable may
+			// be called asynchronously to this method (since it is a delegate reacting
+			// to event in the container), so we want to protect ourselves from data
+			// corruption here. Lock would be an overkill, since we really want to
+			// create the list only once anyway.
+			_createPagerFieldsRunning = true;
+			
+			ControlCollection controls = Controls;
+			controls.Clear ();
+
+			DataPagerFieldItem control;
+			
+			foreach (DataPagerField dpf in _fields) {
+				control = new DataPagerFieldItem (dpf, this);
+				if (dpf.Visible) {
+					dpf.CreateDataPagers (control, _startRowIndex, _maximumRows, _totalRowCount, _fields.IndexOf (dpf));
+					control.DataBind ();
+				}
+				controls.Add (control);
+			}
+
+			_createPagerFieldsRunning = false;
+		}
+
+		public override void DataBind()
+		{
+			OnDataBinding (EventArgs.Empty);
+			EnsureChildControls ();
+			DataBindChildren ();
+		}
+
+		protected virtual IPageableItemContainer FindPageableItemContainer ()
+		{
+			string pagedControlID = PagedControlID;
+			IPageableItemContainer ret = null;
+			
+			if (!String.IsNullOrEmpty (pagedControlID)) {
+				Control ctl = FindControl (pagedControlID, 0);
+				if (ret == null)
+					throw new InvalidOperationException (String.Format (_exceptionMessages [NO_PAGED_CONTAINER_ID], pagedControlID));
+
+				ret = ctl as IPageableItemContainer;
+				if (ret == null)
+					throw new InvalidOperationException (String.Format (_exceptionMessages [CONTROL_NOT_PAGEABLE], pagedControlID));
+
+				return ret;
+			}
+
+			// No ID set, try to find a container that's pageable
+			Control container = NamingContainer;
+			Page page = Page;
+
+			while (container != page) {
+				if (container == null)
+					throw new InvalidOperationException (_exceptionMessages [NO_NAMING_CONTAINER]);
+
+				ret = container as IPageableItemContainer;
+				if (ret != null)
+					return ret;
+
+				container = container.NamingContainer;
+			}
+
+			return ret;
+		}
+
+		protected internal override void LoadControlState (object savedState)
+		{
+			object[] state = savedState as object[];
+			object tmp;
+			
+			if (state != null) {
+				base.LoadControlState (state [STATE_BASE_STATE]);
+
+				if ((tmp = state [STATE_TOTAL_ROW_COUNT]) != null)
+					_totalRowCount = (int) tmp;
+
+				if ((tmp = state [STATE_MAXIMUM_ROWS]) != null)
+					_maximumRows = (int) tmp;
+
+				if ((tmp = state [STATE_START_ROW_INDEX]) != null)
+					_startRowIndex = (int) tmp;
+			}
+
+			if (_pageableContainer == null) {
+				_pageableContainer = FindPageableItemContainer ();
+				if (_pageableContainer == null)
+					throw new InvalidOperationException (_exceptionMessages [NO_DATABOUND_CONTROL]);
+				ConnectToEvents (_pageableContainer);
+			}
+			
+			SetUpForNewContainer (false);
+		}
+
+		protected override void LoadViewState (object savedState)
+		{
+			Pair state = savedState as Pair;
+
+			if (state == null)
+				return;
+
+			base.LoadViewState (state.First);
+			object myState = state.Second;
+			if (myState != null)
+				((IStateManager) Fields).LoadViewState (myState);
+		}
+
+		protected override bool OnBubbleEvent (object source, EventArgs e)
+		{
+			DataPagerFieldCommandEventArgs args = e as DataPagerFieldCommandEventArgs;
+
+			if (args != null) {
+				DataPagerFieldItem item = args.Item;
+				DataPagerField field = item != null ? item.PagerField : null;
+				
+				if (field != null) {
+					field.HandleEvent (args);
+					return true;
+				}
+			}
+
+			return false;
+		}
+
+		void SetUpForNewContainer (bool dataBind)
+		{
+			if (!_needNewContainerSetup)
+				return;
+			
+			ConnectToEvents (_pageableContainer);
+			_pageableContainer.SetPageProperties (_startRowIndex, _maximumRows, false);
+			_needNewContainerSetup = false;
+		}
+		
+		protected internal override void OnInit (EventArgs e)
+		{
+			base.OnInit (e);
+
+			Page page = Page;
+			if (page != null)
+				page.RegisterRequiresControlState (this);
+			
+			// It might return null here - there is no guarantee all the controls on the
+			// page are already initialized by the time this method is loaded. Do not
+			// throw for that reason.
+			_pageableContainer = FindPageableItemContainer ();
+			if (_pageableContainer != null)
+				// Do not re-bind the data here - not all the controls might be
+				// initialized (that includes the container may be bound to)
+				SetUpForNewContainer (false);
+
+			_initDone = true;
+		}
+
+		protected internal override void OnLoad (EventArgs e)
+		{
+			if (_pageableContainer == null)
+				_pageableContainer = FindPageableItemContainer ();
+			
+			if (_pageableContainer == null)
+				throw new InvalidOperationException (_exceptionMessages [NO_PAGEABLE_ITEM_CONTAINER]);
+
+			SetUpForNewContainer (false);
+			base.OnLoad (e);
+		}
+
+		protected virtual void OnTotalRowCountAvailable (object sender, PageEventArgs e)
+		{
+			_totalRowCount = e.TotalRowCount;
+			_maximumRows = e.MaximumRows;
+			_startRowIndex = e.StartRowIndex;
+
+			// Sanity checks: if the total row count is less than the current start row
+			// index, we must adjust and rebind the associated container control
+			if (_totalRowCount > 0 && (_totalRowCount <= _startRowIndex)) {
+				// Adjust the container's start row index to the new maximum rows
+				// count, but do not touch our index - we aren't a "view", so we
+				// don't want/need to change the start index.
+				int tmp = _startRowIndex - _maximumRows;
+				if (tmp < 0 || tmp >= _totalRowCount)
+					tmp = 0;
+
+				// Trigger the databinding, which will call us again, with adjusted
+				// data, so that we can recreate the pager fields.
+				_pageableContainer.SetPageProperties (tmp, _maximumRows, true);
+			} else if (!_createPagerFieldsRunning)
+				// No adjustments necessary, re-create the pager fields
+				CreatePagerFields ();
+		}
+
+		protected virtual void RecreateChildControls ()
+		{
+			// This is used only by VS designer
+			throw new NotImplementedException ();
+		}
+
+		protected internal override void Render (HtmlTextWriter writer)
+		{
+			RenderBeginTag (writer);
+			RenderContents (writer);
+			writer.RenderEndTag ();
+		}
+
+		public virtual void RenderBeginTag (HtmlTextWriter writer)
+		{
+			AddAttributesToRender (writer);
+			writer.RenderBeginTag (TagKey);
+		}
+
+		protected virtual void RenderContents (HtmlTextWriter writer)
+		{
+			// Nothing special to render, just child controls
+			base.Render (writer);
+		}
+
+		protected internal override object SaveControlState ()
+		{
+			object[] ret = new object [4];
+
+			ret [STATE_BASE_STATE] = base.SaveControlState ();
+			ret [STATE_TOTAL_ROW_COUNT] = _totalRowCount <= 0 ? 0 : _totalRowCount;
+			ret [STATE_MAXIMUM_ROWS] = _maximumRows <= 0 ? 0 : _maximumRows;
+			ret [STATE_START_ROW_INDEX] = _startRowIndex <= 0 ? 0 : _startRowIndex;
+
+			return ret;
+		}
+
+		protected override object SaveViewState ()
+		{
+			Pair ret = new Pair ();
+
+			ret.First = base.SaveViewState ();
+			ret.Second = _fields != null ? ((IStateManager) _fields).SaveViewState () : null;
+
+			return ret;
+		}
+
+		public virtual void SetPageProperties (int startRowIndex, int maximumRows, bool databind)
+		{
+			if (_pageableContainer == null)
+				throw new InvalidOperationException (_exceptionMessages [NO_DATABOUND_CONTROL]);
+
+			_startRowIndex = startRowIndex;
+			_maximumRows = maximumRows;
+
+			_pageableContainer.SetPageProperties (startRowIndex, maximumRows, databind);
+		}
+
+		protected override void TrackViewState ()
+		{
+			base.TrackViewState ();
+			if (_fields != null)
+				((IStateManager) _fields).TrackViewState ();
+		}
+
+		[BrowsableAttribute(false)]
+		public AttributeCollection Attributes {
+			get {
+				if (_attributes == null)
+					_attributes = new AttributeCollection (new StateBag ());
+				
+				return _attributes;
+			}
+		}
+
+		public override ControlCollection Controls {
+			get {
+				EnsureChildControls ();
+				return base.Controls;
+			}
+		}
+
+		[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
+		public virtual DataPagerFieldCollection Fields {
+			get { return _fields; }
+		}
+
+		[BrowsableAttribute(false)]
+		public int MaximumRows {
+			get { return _maximumRows; }
+		}
+
+		[ThemeableAttribute(false)]
+		public virtual string PagedControlID {
+			get {
+				string ret = ViewState ["PagedControlID"] as string;
+				if (ret == null)
+					return String.Empty;
+
+				return ret;
+			}
+			
+			set { ViewState ["PagedControlID"] = value; }
+		}
+
+		public int PageSize {
+			get { return _maximumRows; }
+			set {
+				if (value < 1)
+					throw new ArgumentOutOfRangeException ("value");
+
+				if (value == _maximumRows)
+					return;
+				
+				_maximumRows = value;
+				if (_initDone) {
+					// We have a source and the page size has changed, update
+					// the container
+					CreatePagerFields ();
+
+					// Environment has changed, let the container know that it
+					// needs to rebind.
+					SetPageProperties (_startRowIndex, _maximumRows, true);
+				}
+			}
+		}
+
+		public string QueryStringField {
+			get {
+				string ret = ViewState ["QueryStringField"] as string;
+				if (ret == null)
+					return String.Empty;
+
+				return ret;
+			}
+			
+			set { ViewState ["QueryStringField"] = value; }
+		}
+
+		[BrowsableAttribute(false)]
+		public int StartRowIndex {
+			get { return _startRowIndex; }
+		}
+
+		[BrowsableAttribute(false)]
+		protected virtual HtmlTextWriterTag TagKey {
+			get { return HtmlTextWriterTag.Span; }
+		}
+
+		[BrowsableAttribute(false)]
+		public int TotalRowCount {
+			get { return _totalRowCount; }
+		}
+
+		string IAttributeAccessor.GetAttribute (string key)
+		{
+			return Attributes [key];
+		}
+
+		void IAttributeAccessor.SetAttribute (string key, string value)
+		{
+			Attributes [key] = value;
+		}
+
+		void ICompositeControlDesignerAccessor.RecreateChildControls ()
+		{
+			RecreateChildControls ();
+		}
+	}
+}
+#endif

+ 196 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/DataPagerField.cs

@@ -0,0 +1,196 @@
+//
+// System.Web.UI.WebControls.DataPagerField
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Security.Permissions;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+	[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	public abstract class DataPagerField : IStateManager
+	{
+		StateBag _state = new StateBag ();
+		DataPager _dataPager;
+
+		bool _queryStringHandled;
+		bool _isTrackingViewState;
+		string _queryStringNavigateUrl;
+		
+		protected DataPagerField ()
+		{
+		}
+
+		protected internal DataPagerField CloneField ()
+		{
+			DataPagerField ret = CreateField ();
+			CopyProperties (ret);
+
+			return ret;
+		}
+
+		protected virtual void CopyProperties (DataPagerField newField)
+		{
+			// assuming we should copy only the public properties
+			newField.Visible = Visible;
+		}
+
+		public abstract void CreateDataPagers (DataPagerFieldItem container, int startRowIndex, int maximumRows,
+						       int totalRowCount, int fieldIndex);
+
+		protected abstract DataPagerField CreateField ();
+
+		protected string GetQueryStringNavigateUrl (int pageNumber)
+		{
+			if (_queryStringNavigateUrl == null && _dataPager != null) {
+				HttpContext ctx = HttpContext.Current;
+				HttpRequest req = ctx != null ? ctx.Request : null;
+				string queryFieldName = _dataPager.QueryStringField;
+				
+				if (req != null) {
+					StringBuilder sb = new StringBuilder (req.Path + "?");
+					NameValueCollection coll = req.QueryString;
+					
+					foreach (string k in coll.AllKeys) {
+						if (String.Compare (k, queryFieldName, StringComparison.OrdinalIgnoreCase) == 0)
+							continue;
+						sb.Append (HttpUtility.UrlEncode (k) + "=" + HttpUtility.UrlEncode (coll [k]) + "&");
+					}
+
+					sb.Append (queryFieldName + "=");
+					_queryStringNavigateUrl = sb.ToString ();
+				} else
+					_queryStringNavigateUrl = String.Empty;
+			}
+
+			return _queryStringNavigateUrl + pageNumber.ToString (CultureInfo.InvariantCulture);
+		}
+
+		public abstract void HandleEvent (CommandEventArgs e);
+
+		protected virtual void LoadViewState (Object savedState)
+		{
+			if (savedState == null)
+				return;
+
+			((IStateManager) ViewState).LoadViewState (savedState);
+		}
+		
+		protected virtual void OnFieldChanged ()
+		{
+			if (FieldChanged != null)
+				FieldChanged (this, EventArgs.Empty);
+		}
+
+		protected virtual object SaveViewState ()
+		{
+			return ((IStateManager) ViewState).SaveViewState ();
+		}
+
+		protected virtual void TrackViewState ()
+		{
+			_isTrackingViewState = true;
+			((IStateManager)ViewState).TrackViewState ();
+		}
+
+		protected DataPager DataPager {
+			get { return _dataPager; }
+		}
+		
+		protected bool QueryStringHandled {
+			get { return _queryStringHandled; }
+			set { _queryStringHandled = value; }
+		}
+
+		protected string QueryStringValue {
+			get {
+				if (_dataPager == null)
+					return String.Empty;
+				
+				HttpContext ctx = HttpContext.Current;
+				HttpRequest req = ctx != null ? ctx.Request : null;
+
+				if (req == null)
+					return String.Empty;
+
+				return req.QueryString [_dataPager.QueryStringField];
+			}
+		}
+
+		protected StateBag ViewState {
+			get { return _state; }
+		}
+
+		public bool Visible {
+			get {
+				object o = ViewState ["Visible"];
+				if (o == null)
+					return true;
+
+				return (bool) o;
+			}
+			
+			set {
+				if (value != Visible) {
+					ViewState ["Visible"] = value;
+					OnFieldChanged ();
+				}
+			}
+		}
+
+		void IStateManager.TrackViewState ()
+		{
+			TrackViewState ();
+		}
+
+		bool IStateManager.IsTrackingViewState {
+			get { return _isTrackingViewState; }
+		}
+
+		object IStateManager.SaveViewState ()
+		{
+			return SaveViewState ();
+		}
+
+		void IStateManager.LoadViewState (object state)
+		{
+			LoadViewState (state);
+		}
+
+		internal event EventHandler FieldChanged;
+	}
+}
+#endif

+ 122 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/DataPagerFieldCollection.cs

@@ -0,0 +1,122 @@
+//
+// System.Web.UI.WebControls.DataPagerFieldCollection
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+	[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	public class DataPagerFieldCollection : StateManagedCollection
+	{
+		public DataPagerFieldCollection (DataPager dataPager)
+		{
+		}
+
+		public void Add (DataPagerField field)
+		{
+		}
+
+		public DataPagerFieldCollection CloneFields (DataPager pager)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public bool Contains (DataPagerField field)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public void CopyTo (DataPagerField[] array, int index)
+		{
+		}
+
+		protected override object CreateKnownType (int index)
+		{
+			throw new NotImplementedException ();
+		}
+		
+		protected override Type[] GetKnownTypes ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		public int IndexOf (DataPagerField field)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public void Insert (int index, DataPagerField field)
+		{
+		}
+
+		protected override void OnClearComplete ()
+		{
+		}
+
+		protected override void OnInsertComplete (int index, object value)
+		{
+		}
+
+		protected override void OnRemoveComplete (int index, object value)
+		{
+		}
+
+		protected override void OnValidate (object o)
+		{
+		}
+
+		public void Remove (DataPagerField field)
+		{
+		}
+
+		public void RemoveAt (int index)
+		{
+		}
+
+		protected override void SetDirtyObject (object o)
+		{
+		}
+
+		[BrowsableAttribute(false)]
+		public DataPagerField this [int index] {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		public event EventHandler FieldsChanged;
+	}
+}
+#endif

+ 62 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/DataPagerFieldCommandEventArgs.cs

@@ -0,0 +1,62 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+	[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	public class DataPagerFieldCommandEventArgs : CommandEventArgs
+	{
+		DataPagerFieldItem _item;
+		object _commandSource;
+		
+		public DataPagerFieldCommandEventArgs (DataPagerFieldItem item, object commandSource, CommandEventArgs originalArgs)
+			: base (originalArgs)
+		{
+			_item = item;
+			_commandSource = commandSource;
+		}
+
+		public object CommandSource {
+			get { return _commandSource; }
+		}
+
+		public DataPagerFieldItem Item {
+			get { return _item; }
+		}
+	}
+}
+#endif

+ 66 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/DataPagerFieldItem.cs

@@ -0,0 +1,66 @@
+//
+// System.Web.UI.WebControls.DataPagerField
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+	[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	public class DataPagerFieldItem : Control, INamingContainer
+	{
+		public DataPagerFieldItem (DataPagerField field, DataPager pager)
+		{
+		}
+
+		protected override bool OnBubbleEvent (object source, EventArgs e)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public DataPager Pager {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		public DataPagerField PagerField {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+	}
+}
+#endif

+ 50 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/IPageableItemContainer.cs

@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.IPageableItemContainer
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+	[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	public interface IPageableItemContainer
+	{
+		void SetPageProperties(int startRowIndex, int maximumRows, bool databind);
+
+		int MaximumRows { get; }
+		int StartRowIndex { get; }
+
+		event EventHandler<PageEventArgs> TotalRowCountAvailable;
+	}
+}
+#endif

+ 40 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/InsertItemPosition.cs

@@ -0,0 +1,40 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+namespace System.Web.UI.WebControls
+{
+	public enum InsertItemPosition
+	{
+		None,
+		FirstItem,
+		LastItem
+	}
+}
+#endif

+ 1112 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListView.cs

@@ -0,0 +1,1112 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+
+namespace System.Web.UI.WebControls
+{
+	[DefaultEventAttribute ("SelectedIndexChanged")]
+	[ControlValuePropertyAttribute ("SelectedValue")]
+	[DesignerAttribute ("System.Web.UI.Design.WebControls.ListViewDesigner, System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
+	[SupportsEventValidationAttribute ()]
+	[ToolboxBitmapAttribute (typeof (ListView), "ListView.ico")]
+	[DefaultPropertyAttribute ("SelectedValue")]
+	public class ListView : DataBoundControl, INamingContainer, IPageableItemContainer
+	{
+		ITemplate _emptyDataTemplate;
+		ITemplate _emptyItemTemplate;
+		ITemplate _insertItemTemplate;
+		ITemplate _groupSeparatorTemplate;
+		ITemplate _groupTemplate;
+		ITemplate _itemSeparatorTemplate;
+		ITemplate _itemTemplate;
+		ITemplate _selectedItemTemplate;
+		ITemplate _alternatingItemTemplate;
+		ITemplate _editItemTemplate;
+		ITemplate _layoutTemplate;
+
+		int _startRowIndex;
+		int _maximumRows;
+		int _selectedIndex;
+		int _editIndex;
+		int _groupItemCount;
+
+		string [] _dataKeyNames;
+		DataKeyArray _dataKeys;
+		ArrayList _dataKeyArray;
+		SortDirection _sortDirection = SortDirection.Ascending;
+		string _sortExpression = String.Empty;
+
+		Control _layoutTemplatePlaceholder;
+		IOrderedDictionary _lastInsertValues;
+		
+		public ListView ()
+		{
+			InsertItemPosition = InsertItemPosition.None;
+		}
+		
+		protected virtual void AddControlToContainer (Control control, Control container, int addLocation)
+		{
+			if (control == null || container == null)
+				return;
+
+			Control ctl;
+
+			if (container is HtmlTable) {
+				ctl = new ListViewTableRow ();
+				ctl.Controls.Add (control);
+			} else
+				ctl = control;
+			
+			container.Controls.AddAt (addLocation, ctl);
+		}
+	
+		protected internal override void CreateChildControls ()
+		{
+			if (RequiresDataBinding)
+				EnsureDataBound ();
+			
+			base.CreateChildControls ();
+		}
+	
+		protected virtual int CreateChildControls (IEnumerable dataSource, bool dataBinding)
+		{
+			IList <ListViewDataItem> retList = null;
+
+			EnsureLayoutTemplate ();
+			RemoveItems ();
+
+			bool haveDataToDisplay = _maximumRows > 0 && _startRowIndex > 0;
+			var pagedDataSource = new ListViewPagedDataSource ();
+			
+			if (dataBinding) {
+				DataSourceView view = GetData ();
+				if (view == null)
+					throw new InvalidOperationException ("dataSource returned a null reference for DataSourceView.");
+
+				if (!(dataSource is ICollection))
+					throw new InvalidOperationException ("dataSource does not implement the ICollection interface.");
+
+				int totalRowCount = 0;
+				if (haveDataToDisplay) {
+					if (view.CanRetrieveTotalRowCount)
+						totalRowCount = SelectArguments.TotalRowCount;
+					else 
+						totalRowCount = ((ICollection) dataSource).Count + _startRowIndex;
+				}
+				
+				pagedDataSource.StartRowIndex = _startRowIndex;
+				pagedDataSource.DataSource = dataSource;
+				pagedDataSource.TotalRowCount = totalRowCount;
+			} else {
+				if (!(dataSource is ICollection))
+					throw new InvalidOperationException ("dataSource does not implement the ICollection interface and dataBinding is false.");
+			}
+
+			if (GroupItemCount <= 0) {
+				retList = CreateItemsWithoutGroups (pagedDataSource, dataBinding, InsertItemPosition, DataKeyArray);
+				Console.WriteLine ("Data key names:");
+				foreach (string s in DataKeyNames)
+					Console.WriteLine ("\t{0}", s);
+				
+				Console.WriteLine ("Keys:");
+				foreach (object o in DataKeyArray)
+					Console.WriteLine ("\t{0}", o);
+			}
+			
+			if (retList == null)
+				return 0;
+
+			return retList.Count;
+		}
+	
+		protected override Style CreateControlStyle ()
+		{
+			throw StylingNotSupported ();
+		}
+	
+		protected virtual ListViewDataItem CreateDataItem (int dataItemIndex, int displayIndex)
+		{
+			return new ListViewDataItem (dataItemIndex, displayIndex);
+		}
+	
+		protected override DataSourceSelectArguments CreateDataSourceSelectArguments ()
+		{
+			DataSourceSelectArguments arg = DataSourceSelectArguments.Empty;
+			DataSourceView view = GetData();
+			
+			if (view.CanPage) {
+				arg.StartRowIndex = _startRowIndex;
+				if (view.CanRetrieveTotalRowCount) {
+					arg.RetrieveTotalRowCount = true;
+					arg.MaximumRows = _maximumRows;
+				} else
+					arg.MaximumRows = -1;
+			}
+
+			if (IsBoundUsingDataSourceID && !String.IsNullOrEmpty (_sortExpression)) {
+				if (_sortDirection == SortDirection.Ascending)
+					arg.SortExpression = _sortExpression;
+				else
+					arg.SortExpression = _sortExpression + " DESC";
+			}
+			
+			return arg;
+		}
+	
+		protected virtual void CreateEmptyDataItem ()
+		{
+			if (_emptyDataTemplate != null) {
+				ListViewItem item = CreateItem (ListViewItemType.EmptyItem);
+				InstantiateEmptyDataTemplate (item);
+				OnItemCreated (new ListViewItemEventArgs (item));
+				AddControlToContainer (item, this, 0);
+			}
+		}
+	
+		protected virtual ListViewItem CreateEmptyItem ()
+		{
+			if (_emptyDataTemplate != null) {
+				ListViewItem item = CreateItem (ListViewItemType.EmptyItem);
+				InstantiateEmptyItemTemplate (item);
+				OnItemCreated (new ListViewItemEventArgs (item));
+				return item;
+			}
+
+			return null;
+		}
+	
+		protected virtual ListViewItem CreateInsertItem ()
+		{
+			ListViewItem ret = CreateItem (ListViewItemType.InsertItem);
+			InsertItem = ret;
+
+			return ret;
+		}
+	
+		protected virtual ListViewItem CreateItem (ListViewItemType itemType)
+		{
+			return new ListViewItem (itemType);
+		}
+	
+		protected virtual IList <ListViewDataItem> CreateItemsInGroups (ListViewPagedDataSource dataSource, bool dataBinding, InsertItemPosition insertPosition,
+										ArrayList keyArray)
+		{
+			if (_groupTemplate == null)
+				return null;
+			
+			throw new NotImplementedException ();
+		}
+	
+		protected virtual IList <ListViewDataItem> CreateItemsWithoutGroups (ListViewPagedDataSource dataSource, bool dataBinding,
+										     InsertItemPosition insertPosition, ArrayList keyArray)
+		{
+			Control contentPlaceholder = FindPlaceholder (ItemPlaceholderID, _layoutTemplatePlaceholder);
+			
+			if (contentPlaceholder == null)
+				return new List <ListViewDataItem> ();
+
+			Control parent = contentPlaceholder.Parent;
+			int ipos = 0;
+			
+			if (parent != null) {
+				ipos = parent.Controls.IndexOf (contentPlaceholder);
+				parent.Controls.Remove (contentPlaceholder);
+				contentPlaceholder = parent;
+				AddControlToContainer (contentPlaceholder, _layoutTemplatePlaceholder, 0);
+			}
+
+			List <ListViewDataItem> ret = new List <ListViewDataItem> ();
+			ListViewItem lvi;
+			ListViewItem container;
+			bool needSeparator = false;
+
+			if (insertPosition == InsertItemPosition.FirstItem) {
+				lvi = CreateInsertItem ();
+				InstantiateInsertItemTemplate (lvi);
+				AddControlToContainer (lvi, contentPlaceholder, ipos++);
+				needSeparator = true;
+			}
+
+			bool haveSeparatorTemplate = _itemSeparatorTemplate != null;
+			int displayIndex = 0;
+			ListViewDataItem lvdi;
+			int startIndex = dataSource.StartRowIndex;
+			
+			foreach (object item in dataSource) {
+				if (needSeparator && haveSeparatorTemplate) {
+					container = new ListViewItem ();
+					InstantiateItemSeparatorTemplate (container);
+					AddControlToContainer (container, contentPlaceholder, ipos++);
+				}
+
+				lvdi = CreateDataItem (startIndex + displayIndex, displayIndex);
+				InstantiateItemTemplate (lvdi, displayIndex);
+
+				if (dataBinding) {
+					lvdi.DataItem = item;
+
+					OrderedDictionary dict = new OrderedDictionary ();
+					string[] dataKeyNames = DataKeyNames;
+					
+					foreach (string s in dataKeyNames)
+						dict.Add (s, DataBinder.GetPropertyValue (item, s));
+
+					DataKey dk = new DataKey (dict, dataKeyNames);
+					if (keyArray.Count == displayIndex)
+						keyArray.Add (dk);
+					else
+						keyArray [displayIndex] = dk;
+				}
+				
+				OnItemCreated (new ListViewItemEventArgs (lvdi));
+				AddControlToContainer (lvdi, contentPlaceholder, ipos++);
+
+				if (!needSeparator)
+					needSeparator = true;
+
+				if (dataBinding) {
+					lvdi.DataBind ();
+					OnItemDataBound (new ListViewItemEventArgs (lvdi));
+				}
+				displayIndex++;
+
+				ret.Add (lvdi);
+			}
+
+			if (insertPosition == InsertItemPosition.LastItem) {
+				if (needSeparator && haveSeparatorTemplate) {
+					container = new ListViewItem ();
+					InstantiateItemSeparatorTemplate (container);
+					AddControlToContainer (container, contentPlaceholder, ipos++);
+				}
+				
+				lvi = CreateInsertItem ();
+				InstantiateInsertItemTemplate (lvi);
+				AddControlToContainer (lvi, contentPlaceholder, ipos++);
+			}
+			
+			return ret;
+		}
+	
+		protected virtual void CreateLayoutTemplate ()
+		{
+			if (_layoutTemplate != null) {
+				_layoutTemplatePlaceholder = new Control ();
+				_layoutTemplate.InstantiateIn (_layoutTemplatePlaceholder);
+				AddControlToContainer (_layoutTemplatePlaceholder, this, 0);
+			}
+			
+			OnLayoutCreated (EventArgs.Empty);
+		}
+	
+		public virtual void DeleteItem (int itemIndex)
+		{
+		}
+	
+		protected virtual void EnsureLayoutTemplate ()
+		{
+			Controls.Clear ();
+			CreateLayoutTemplate ();
+		}
+	
+		public virtual void ExtractItemValues (IOrderedDictionary itemValues, ListViewItem item, bool includePrimaryKey)
+		{
+			if (itemValues == null)
+				throw new ArgumentNullException ("itemValues");
+			
+			if (!(item is ListViewDataItem))
+				throw new InvalidOperationException ("item is not a ListViewDataItem object.");
+		}
+	
+		protected virtual Control FindPlaceholder (string containerID, Control container)
+		{
+			if (container == null || String.IsNullOrEmpty (containerID))
+				return null;
+
+			return container.FindControl (containerID);
+		}
+	
+		public virtual void InsertNewItem (bool causesValidation)
+		{
+			ListViewItem insertItem = InsertItem;
+
+			if (insertItem == null)
+				throw new InvalidOperationException ("The ListView control does not have an insert item.");
+
+			DataSourceView dsv = null;
+			ListViewInsertEventArgs eventArgs = null;
+			
+			if (IsBoundUsingDataSourceID) {
+				dsv = GetData ();
+				if (dsv == null)
+					throw new InvalidOperationException ("Missing data.");
+
+				eventArgs = new ListViewInsertEventArgs (insertItem);
+				ExtractItemValues (eventArgs.Values, insertItem, true);
+			} else
+				eventArgs = new ListViewInsertEventArgs (insertItem);
+
+			OnItemInserting (eventArgs);
+			if (!eventArgs.Cancel && IsBoundUsingDataSourceID) {
+				_lastInsertValues = eventArgs.Values;
+				dsv.Insert (_lastInsertValues, new DataSourceViewOperationCallback (InsertNewItemCallback));
+			}
+		}
+
+		bool InsertNewItemCallback (int recordsAffected, Exception ex)
+		{
+			var eventArgs = new ListViewInsertedEventArgs (_lastInsertValues, recordsAffected, ex);
+			OnItemInserted (eventArgs);
+			_lastInsertValues = null;
+
+			if (ex != null && !eventArgs.ExceptionHandled)
+				return false;
+
+			// This will effectively reset the insert values
+			if (!eventArgs.KeepInInsertMode)
+				RequiresDataBinding = true;
+
+			return true;
+		}
+		
+		protected virtual void InstantiateEmptyDataTemplate (Control container)
+		{
+			if (_emptyDataTemplate != null)
+				_emptyDataTemplate.InstantiateIn (container);
+		}
+	
+		protected virtual void InstantiateEmptyItemTemplate (Control container)
+		{
+			if (_emptyItemTemplate != null)
+				_emptyItemTemplate.InstantiateIn (container);
+		}
+	
+		protected virtual void InstantiateGroupSeparatorTemplate (Control container)
+		{
+			if (_groupSeparatorTemplate != null)
+				_groupSeparatorTemplate.InstantiateIn (container);
+		}
+		
+		protected virtual void InstantiateGroupTemplate (Control container)
+		{
+			if (_groupTemplate != null)
+				_groupTemplate.InstantiateIn (container);
+		}
+	
+		protected virtual void InstantiateInsertItemTemplate (Control container)
+		{
+			if (_insertItemTemplate != null)
+				_insertItemTemplate.InstantiateIn (container);
+		}
+	
+		protected virtual void InstantiateItemSeparatorTemplate (Control container)
+		{
+			if (_itemSeparatorTemplate != null)
+				_itemSeparatorTemplate.InstantiateIn (container);
+		}
+	
+		protected virtual void InstantiateItemTemplate (Control container, int displayIndex)
+		{
+			if (_itemTemplate == null)
+				throw new InvalidOperationException ("ItemTemplate is missing");
+
+			ITemplate template = _itemTemplate;
+
+			if ((displayIndex % 2 != 0) && _alternatingItemTemplate != null)
+				template = _alternatingItemTemplate;
+			
+			if ((displayIndex == _selectedIndex) && _selectedItemTemplate != null)
+				template = _selectedItemTemplate;
+
+			if ((displayIndex == _editIndex) && _editItemTemplate != null)
+				template = _editItemTemplate;
+
+			template.InstantiateIn (container);
+		}
+	
+		protected override void LoadControlState (object savedState)
+		{
+		}
+	
+		protected override void LoadViewState (object savedState)
+		{
+		}
+	
+		protected override bool OnBubbleEvent (object source, EventArgs e)
+		{
+			throw new NotImplementedException ();
+		}
+	
+		protected override void OnInit (EventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemCanceling (ListViewCancelEventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemCommand (ListViewCommandEventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemCreated (ListViewItemEventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemDataBound (ListViewItemEventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemDeleted (ListViewDeletedEventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemDeleting (ListViewDeleteEventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemEditing (ListViewEditEventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemInserted (ListViewInsertedEventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemInserting (ListViewInsertEventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemUpdated (ListViewUpdatedEventArgs e)
+		{
+		}
+	
+		protected virtual void OnItemUpdating (ListViewUpdateEventArgs e)
+		{
+		}
+	
+		protected virtual void OnLayoutCreated (EventArgs e)
+		{
+		}
+	
+		protected virtual void OnPagePropertiesChanged (EventArgs e)
+		{
+		}
+	
+		protected virtual void OnPagePropertiesChanging (PagePropertiesChangingEventArgs e)
+		{
+		}
+	
+		protected virtual void OnSelectedIndexChanged (EventArgs e)
+		{
+		}
+	
+		protected virtual void OnSelectedIndexChanging (ListViewSelectEventArgs e)
+		{
+		}
+	
+		protected virtual void OnSorted (EventArgs e)
+		{
+		}
+	
+		protected virtual void OnSorting (ListViewSortEventArgs e)
+		{
+		}
+	
+		protected virtual void OnTotalRowCountAvailable (PageEventArgs e)
+		{
+		}
+	
+		protected override void PerformDataBinding (IEnumerable data)
+		{
+			base.PerformDataBinding (data);
+			TrackViewState ();
+
+			int childCount = CreateChildControls (data, true);
+			ChildControlsCreated = true;
+		}
+	
+		protected override void PerformSelect ()
+		{
+			EnsureLayoutTemplate ();
+			base.PerformSelect ();
+		}
+	
+		protected virtual void RemoveItems ()
+		{
+		}
+	
+		protected override void Render (HtmlTextWriter writer)
+		{
+			base.Render (writer);
+		}
+	
+		protected override object SaveControlState ()
+		{
+			throw new NotImplementedException ();
+		}
+	
+		protected override object SaveViewState ()
+		{
+			object[] states = new object [2];
+
+			states [0] = base.SaveViewState ();
+			states [1] = null;
+
+			return states;
+		}
+	
+		protected virtual void SetPageProperties (int startRowIndex, int maximumRows, bool databind)
+		{
+		}
+	
+		public virtual void Sort (string sortExpression, SortDirection sortDirection)
+		{
+		}
+	
+		void IPageableItemContainer.SetPageProperties (int startRowIndex, int maximumRows, bool databind)
+		{
+			throw new NotImplementedException ();
+		}
+	
+		public virtual void UpdateItem (int itemIndex, bool causesValidation)
+		{
+		}
+	
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		[BrowsableAttribute (false)]
+		public override string AccessKey {
+			get { return base.AccessKey; }
+			set { throw StylingNotSupported (); }
+		}
+	
+		[TemplateContainerAttribute (typeof (ListViewDataItem), BindingDirection.TwoWay)]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		[DefaultValueAttribute (null)]
+		[BrowsableAttribute (false)]
+		public virtual ITemplate AlternatingItemTemplate {
+			get { return _alternatingItemTemplate; }
+			set { _alternatingItemTemplate = value; }
+		}
+	
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		[BrowsableAttribute (false)]
+		public override Color BackColor {
+			get { return base.BackColor; }
+			set { throw StylingNotSupported (); }
+		}
+	
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		[BrowsableAttribute (false)]
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		public override Color BorderColor {
+			get { return base.BorderColor; }
+			set { throw StylingNotSupported (); }
+		}
+	
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		[BrowsableAttribute (false)]
+		public override BorderStyle BorderStyle {
+			get { return base.BorderStyle; }
+			set { throw StylingNotSupported (); }
+		}
+	
+		[BrowsableAttribute (false)]
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public override Unit BorderWidth {
+			get { return base.BorderWidth; }
+			set { throw StylingNotSupported (); }
+		}
+	
+		public override ControlCollection Controls {
+			get {
+				EnsureChildControls ();
+				return base.Controls;
+			}
+		}
+	
+		[CategoryAttribute ("Behavior")]
+		[DefaultValueAttribute (true)]
+		public virtual bool ConvertEmptyStringToNull {
+			get {
+				object o = ViewState ["ConvertEmptyStringToNull"];
+				if (o != null)
+					return (bool) o;
+
+				return true;
+			}
+			
+			set { ViewState ["ConvertEmptyStringToNull"] = value; }
+		}
+	
+		public override string CssClass {
+			get { return base.CssClass; }
+			set { throw StylingNotSupported (); }
+		}
+	
+		[DefaultValueAttribute (null)]
+		[TypeConverterAttribute (typeof (StringArrayConverter))]
+		[CategoryAttribute ("Data")]
+		public virtual string [] DataKeyNames {
+			get {
+				if (_dataKeyNames != null)
+					return _dataKeyNames;
+
+				return new string [0];
+			}
+			set {
+				if (value == null)
+					_dataKeyNames = null;
+				else
+					_dataKeyNames = (string []) value.Clone ();
+
+				// They will eventually be recreated when data binding
+				_dataKeyArray = null;
+				_dataKeys = null;
+				
+				if (Initialized)
+					RequiresDataBinding = true;
+			}
+		}
+	
+		[BrowsableAttribute (false)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public virtual DataKeyArray DataKeys {
+			get {
+				if (_dataKeys == null) {
+					_dataKeys = new DataKeyArray (DataKeyArray);
+					if (IsTrackingViewState)
+						((IStateManager) _dataKeys).TrackViewState ();
+				}
+
+				return _dataKeys;
+			}
+		}
+
+		ArrayList DataKeyArray {
+			get {
+				if (_dataKeyArray == null)
+					_dataKeyArray = new ArrayList ();
+
+				return _dataKeyArray;
+			}
+		}
+		
+		[DefaultValueAttribute (-1)]
+		[CategoryAttribute ("Misc")]
+		public virtual int EditIndex {
+			get { return _editIndex; }
+			set {
+				if (value < -1)
+					throw new ArgumentOutOfRangeException ("value");
+
+				if (value != _editIndex) {
+					_editIndex = value;
+					if (Initialized)
+						RequiresDataBinding = true;
+				}
+			}
+		}
+	
+		[BrowsableAttribute (false)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public virtual ListViewItem EditItem {
+			get { throw new NotImplementedException (); }
+		}
+	
+		[DefaultValueAttribute (null)]
+		[BrowsableAttribute (false)]
+		[TemplateContainerAttribute (typeof (ListViewDataItem), BindingDirection.TwoWay)]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		public virtual ITemplate EditItemTemplate {
+			get { return _editItemTemplate; }
+			set { _editItemTemplate = value; }
+		}
+	
+		[DefaultValueAttribute (null)]
+		[TemplateContainerAttribute (typeof (ListView))]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		[BrowsableAttribute (false)]
+		public virtual ITemplate EmptyDataTemplate {
+			get { return _emptyDataTemplate; }
+			set { _emptyDataTemplate = value; }
+		}
+	
+		[TemplateContainerAttribute (typeof (ListViewItem))]
+		[DefaultValueAttribute (null)]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		[BrowsableAttribute (false)]
+		public virtual ITemplate EmptyItemTemplate {
+			get { return _emptyItemTemplate; }
+			set { _emptyItemTemplate = value; }
+		}
+	
+		[BrowsableAttribute (false)]
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public override FontInfo Font {
+			get { throw StylingNotSupported (); }
+		}
+	
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		[BrowsableAttribute (false)]
+		public override Color ForeColor {
+			get { return base.ForeColor; }
+			set { throw StylingNotSupported (); }
+		}
+	
+		[CategoryAttribute ("Misc")]
+		[DefaultValueAttribute (1)]
+		public virtual int GroupItemCount {
+			get { return _groupItemCount; }
+
+			set {
+				if (value < 1)
+					throw new ArgumentOutOfRangeException ("value");
+
+				if (value != _groupItemCount) {
+					_groupItemCount = value;
+					if (Initialized)
+						RequiresDataBinding = true;
+				}
+			}
+		}
+	
+		[CategoryAttribute ("Behavior")]
+		[DefaultValueAttribute ("groupPlaceholder")]
+		public virtual string GroupPlaceholderID {
+			get {
+				string s = ViewState ["GroupPlaceholderID"] as string;
+				if (s != null)
+					return s;
+
+				return "groupPlaceHolder";
+			}
+			
+			set {
+				if (String.IsNullOrEmpty (value))
+					throw new ArgumentOutOfRangeException ("value");
+
+				ViewState ["GroupPlaceholderID"] = value;
+			}
+		}
+	
+		[BrowsableAttribute (false)]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		[DefaultValueAttribute (null)]
+		[TemplateContainerAttribute (typeof (ListViewItem))]
+		public virtual ITemplate GroupSeparatorTemplate {
+			get { return _groupSeparatorTemplate; }
+			set { _groupSeparatorTemplate = value; }
+		}
+	
+		[TemplateContainerAttribute (typeof (ListViewItem))]
+		[DefaultValueAttribute (null)]
+		[BrowsableAttribute (false)]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		public virtual ITemplate GroupTemplate {
+			get { return _groupTemplate; }
+			set { _groupTemplate = value; }
+		}
+	
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		[BrowsableAttribute (false)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public override Unit Height {
+			get { return base.Height; }
+			set { throw StylingNotSupported (); }
+		}
+	
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		[BrowsableAttribute (false)]
+		public virtual ListViewItem InsertItem {
+			get;
+			private set;
+		}
+	
+		[CategoryAttribute ("Misc")]
+		[DefaultValueAttribute (InsertItemPosition.None)]
+		public virtual InsertItemPosition InsertItemPosition {
+			get;
+			set;
+		}
+	
+		[TemplateContainerAttribute (typeof (ListViewItem), BindingDirection.TwoWay)]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		[DefaultValueAttribute (null)]
+		[BrowsableAttribute (false)]
+		public virtual ITemplate InsertItemTemplate {
+			get { return _insertItemTemplate; }
+			set { _insertItemTemplate = value; }
+		}
+	
+		[DefaultValueAttribute ("itemPlaceholder")]
+		[CategoryAttribute ("Behavior")]
+		public virtual string ItemPlaceholderID {
+			get {
+				string s = ViewState ["ItemPlaceHolderID"] as string;
+				if (s != null)
+					return s;
+
+				return "itemPlaceholder";
+			}
+			
+			set {
+				if (String.IsNullOrEmpty (value))
+					throw new ArgumentOutOfRangeException ("value");
+				
+				ViewState ["ItemPlaceHolderID"] = value;
+			}
+		}
+	
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		[BrowsableAttribute (false)]
+		public virtual IList <ListViewDataItem> Items {
+			get { throw new NotImplementedException (); }
+		}
+	
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		[BrowsableAttribute (false)]
+		[TemplateContainerAttribute (typeof (ListViewItem))]
+		[DefaultValueAttribute (null)]
+		public virtual ITemplate ItemSeparatorTemplate {
+			get { return _itemSeparatorTemplate; }
+			set { _itemSeparatorTemplate = value; }
+		}
+	
+		[TemplateContainerAttribute (typeof (ListViewDataItem), BindingDirection.TwoWay)]
+		[DefaultValueAttribute (null)]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		[BrowsableAttribute (false)]
+		public virtual ITemplate ItemTemplate {
+			get { return _itemTemplate; }
+			set { _itemTemplate = value; }
+		}
+	
+		[TemplateContainerAttribute (typeof (ListView))]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		[DefaultValueAttribute (null)]
+		[BrowsableAttribute (false)]
+		public virtual ITemplate LayoutTemplate {
+			get { return _layoutTemplate; }
+			set { _layoutTemplate = value; }
+		}
+	
+		protected virtual int MaximumRows {
+			get { return _maximumRows; }
+		}
+	
+		[BrowsableAttribute (false)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public virtual DataKey SelectedDataKey {
+			get {
+				if (_dataKeyNames == null || _dataKeyNames.Length == 0)
+					throw new InvalidOperationException ("No data keys are specified in the DataKeyNames property.");
+
+				DataKeyArray dataKeys = DataKeys;
+				int selIndex = SelectedIndex;
+				if (selIndex > -1 || selIndex < dataKeys.Count)
+					return dataKeys [selIndex];
+
+				return null;
+			}
+		}
+	
+		[CategoryAttribute ("Misc")]
+		[DefaultValueAttribute (-1)]
+		public virtual int SelectedIndex {
+			get { return _selectedIndex; }
+			set {
+				if (value < -1)
+					throw new ArgumentOutOfRangeException ("value");
+
+				if (value != _selectedIndex) {
+					_selectedIndex = value;
+					if (Initialized)
+						RequiresDataBinding = true;
+				}
+			}
+		}
+	
+		[BrowsableAttribute (false)]
+		[DefaultValueAttribute (null)]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		[TemplateContainerAttribute (typeof (ListViewDataItem), BindingDirection.TwoWay)]
+		public virtual ITemplate SelectedItemTemplate {
+			get { return _selectedItemTemplate; }
+			set { _selectedItemTemplate = value; }
+		}
+	
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		[BrowsableAttribute (false)]
+		public object SelectedValue {
+			get {
+				DataKey dk = SelectedDataKey;
+				if (dk != null)
+					return dk.Value;
+
+				return null;
+			}
+		}
+	
+		[DefaultValueAttribute (SortDirection.Ascending)]
+		[BrowsableAttribute (false)]
+		[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public virtual SortDirection SortDirection {
+			get { return _sortDirection; }
+		}
+	
+		[BrowsableAttribute (false)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public virtual string SortExpression {
+			get { return _sortExpression; }
+		}
+	
+		protected virtual int StartRowIndex {
+			get { return _startRowIndex; }
+		}
+	
+		int IPageableItemContainer.MaximumRows {
+			get { return _maximumRows; }
+		}
+	
+		int IPageableItemContainer.StartRowIndex {
+			get { return _startRowIndex; }
+		}
+	
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		[BrowsableAttribute (false)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public override short TabIndex {
+			get { return 0; }
+			set { throw new NotSupportedException ("ListView does not allow setting this property."); }
+		}
+	
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		[BrowsableAttribute (false)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public override string ToolTip {
+			get { return base.ToolTip; }
+			set { throw StylingNotSupported (); }
+		}
+	
+		[EditorBrowsableAttribute (EditorBrowsableState.Never)]
+		[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		[BrowsableAttribute (false)]
+		public override Unit Width {
+			get { return base.Width; }
+			set { throw StylingNotSupported (); }
+		}
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewCancelEventArgs> ItemCanceling;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewCommandEventArgs> ItemCommand;
+	
+		[CategoryAttribute ("Behavior")]
+		public event EventHandler <ListViewItemEventArgs> ItemCreated;
+	
+		[CategoryAttribute ("Data")]
+		public event EventHandler <ListViewItemEventArgs> ItemDataBound;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewDeletedEventArgs> ItemDeleted;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewDeleteEventArgs> ItemDeleting;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewEditEventArgs> ItemEditing;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewInsertedEventArgs> ItemInserted;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewInsertEventArgs> ItemInserting;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewUpdatedEventArgs> ItemUpdated;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewUpdateEventArgs> ItemUpdating;
+	
+		[CategoryAttribute ("Behavior")]
+		public event EventHandler LayoutCreated;
+	
+		[CategoryAttribute ("Behavior")]
+		public event EventHandler PagePropertiesChanged;
+	
+		[CategoryAttribute ("Behavior")]
+		public event EventHandler <PagePropertiesChangingEventArgs> PagePropertiesChanging;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler SelectedIndexChanged;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewSelectEventArgs> SelectedIndexChanging;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler Sorted;
+	
+		[CategoryAttribute ("Action")]
+		public event EventHandler <ListViewSortEventArgs> Sorting;
+	
+		event EventHandler <PageEventArgs> IPageableItemContainer.TotalRowCountAvailable {
+			add {
+			}
+
+			remove {
+			}
+		}
+
+		NotSupportedException StylingNotSupported ()
+		{
+			return new NotSupportedException ("Style properties are not supported on ListView. Apply styling or CSS classes to the elements in the ListView's templates.");
+		}
+	}
+}
+#endif
+

+ 51 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewCancelEventArgs.cs

@@ -0,0 +1,51 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewCancelEventArgs : System.ComponentModel.CancelEventArgs
+	{
+		public ListViewCancelEventArgs (int itemIndex, ListViewCancelMode cancelMode)
+		{
+		}
+
+		public ListViewCancelMode CancelMode {
+			get { throw new NotImplementedException (); }
+		}
+
+		public int ItemIndex {
+			get { throw new NotImplementedException (); }
+		}
+	}
+}
+#endif

+ 39 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewCancelMode.cs

@@ -0,0 +1,39 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+namespace System.Web.UI.WebControls
+{
+	public enum ListViewCancelMode
+	{
+		CancelingEdit,
+		CancelingInsert
+	}
+}
+#endif

+ 51 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewCommandEventArgs.cs

@@ -0,0 +1,51 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewCommandEventArgs : CommandEventArgs
+	{
+		public ListViewCommandEventArgs (ListViewItem item, object commandSource, CommandEventArgs originalArgs)
+			: base (originalArgs)
+		{
+		}
+		
+		public object CommandSource {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public ListViewItem Item {
+			get { throw new NotImplementedException (); }
+		}
+	}
+}
+#endif

+ 65 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewDataItem.cs

@@ -0,0 +1,65 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewDataItem : ListViewItem, IDataItemContainer
+	{
+		public ListViewDataItem (int dataItemIndex, int displayIndex)
+		{
+			DataItem = null;
+			DataItemIndex = dataItemIndex;
+			DisplayIndex = displayIndex;
+		}
+		
+		protected override bool OnBubbleEvent (object source, EventArgs e)
+		{
+			return base.OnBubbleEvent (source, e);
+		}
+		
+		public virtual object DataItem {
+			get;
+			set;
+		}
+		
+		public virtual int DataItemIndex {
+			get;
+			private set;
+		}
+		
+		public virtual int DisplayIndex {
+			get;
+			private set;
+		}
+	}
+}
+#endif

+ 56 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewDeleteEventArgs.cs

@@ -0,0 +1,56 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewDeleteEventArgs : CancelEventArgs
+	{
+		public ListViewDeleteEventArgs (int itemIndex)
+		{
+		}
+		
+		public int ItemIndex {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public IOrderedDictionary Keys {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public IOrderedDictionary Values {
+			get { throw new NotImplementedException (); }
+		}
+	}
+}
+#endif

+ 64 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewDeletedEventArgs.cs

@@ -0,0 +1,64 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewDeletedEventArgs : EventArgs
+	{
+		public ListViewDeletedEventArgs (int affectedRows, Exception exception)
+		{
+		}
+		
+		public int AffectedRows {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public Exception Exception {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public bool ExceptionHandled {
+			get { throw new NotImplementedException (); }
+			set { }
+		}
+		
+		public IOrderedDictionary Keys {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public IOrderedDictionary Values {
+			get { throw new NotImplementedException (); }
+		}
+	}
+}
+#endif

+ 47 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewEditEventArgs.cs

@@ -0,0 +1,47 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewEditEventArgs : CancelEventArgs
+	{
+		public ListViewEditEventArgs (int newEditIndex)
+		{
+		}
+		
+		public int NewEditIndex {
+			get { throw new NotImplementedException (); }
+		}
+	}
+}
+#endif

+ 54 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewInsertEventArgs.cs

@@ -0,0 +1,54 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewInsertEventArgs : CancelEventArgs
+	{
+		public ListViewInsertEventArgs (ListViewItem item)
+		{
+			Item = item;
+		}
+		
+		public ListViewItem Item {
+			get;
+			private set;
+		}
+		
+		public IOrderedDictionary Values {
+			get { throw new NotImplementedException (); }
+		}
+	}
+}
+#endif

+ 78 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewInsertedEventArgs.cs

@@ -0,0 +1,78 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewInsertedEventArgs : EventArgs
+	{
+		internal ListViewInsertedEventArgs (IOrderedDictionary values, int affectedRows, Exception exception)
+			: this (affectedRows, exception)
+		{
+			Values = values;
+			ExceptionHandled = false;
+			KeepInInsertMode = false;
+		}
+		
+		public ListViewInsertedEventArgs (int affectedRows, Exception exception)
+		{
+			AffectedRows = affectedRows;
+			Exception = exception;
+		}
+		
+		public int AffectedRows {
+			get;
+			private set;
+		}
+		
+		public Exception Exception {
+			get;
+			private set;
+		}
+		
+		public bool ExceptionHandled {
+			get;
+			set;
+		}
+		
+		public bool KeepInInsertMode {
+			get;
+			set;
+		}
+		
+		public IOrderedDictionary Values {
+			get;
+			private set;
+		}
+	}
+}
+#endif

+ 60 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewItem.cs

@@ -0,0 +1,60 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+	[ToolboxItemAttribute (false)]
+	public class ListViewItem : Control, INamingContainer
+	{
+		internal ListViewItem ()
+			: this (ListViewItemType.DataItem)
+		{
+		}
+		
+		public ListViewItem (ListViewItemType itemType)
+		{
+			ItemType = itemType;
+		}
+		
+		protected override bool OnBubbleEvent (object source, EventArgs e)
+		{
+			return base.OnBubbleEvent (source, e);
+		}
+		
+		public ListViewItemType ItemType {
+			get;
+			private set;
+		}
+	}
+}
+#endif

+ 46 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewItemEventArgs.cs

@@ -0,0 +1,46 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewItemEventArgs : EventArgs
+	{
+		public ListViewItemEventArgs (ListViewItem item)
+		{
+		}
+		
+		public ListViewItem Item {
+			get { throw new NotImplementedException (); }
+		}
+	}
+}
+#endif

+ 40 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewItemType.cs

@@ -0,0 +1,40 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+namespace System.Web.UI.WebControls
+{
+	public enum ListViewItemType
+	{
+		DataItem,
+		InsertItem,
+		EmptyItem
+	}
+}
+#endif

+ 159 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewPagedDataSource.cs

@@ -0,0 +1,159 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewPagedDataSource : ICollection, IEnumerable, ITypedList
+	{
+		public ListViewPagedDataSource ()
+		{
+			StartRowIndex = 0;
+			MaximumRows = 0;
+			AllowServerPaging = false;
+			TotalRowCount = 0;
+		}
+		
+		public void CopyTo (Array array, int index)
+		{
+		}
+		
+		public IEnumerator GetEnumerator ()
+		{
+			IEnumerable ds = DataSource;
+
+			if (ds == null)
+				return null;
+
+			return ds.GetEnumerator ();
+		}
+		
+		public PropertyDescriptorCollection GetItemProperties (PropertyDescriptor [] listAccessors)
+		{
+			IEnumerable ds = DataSource;
+
+			if (ds == null || !(ds is ITypedList))
+				return null;
+
+			return ((ITypedList) ds).GetItemProperties (listAccessors);
+		}
+		
+		public string GetListName (PropertyDescriptor [] listAccessors)
+		{
+			return String.Empty;
+		}
+		
+		public bool AllowServerPaging {
+			get;
+			set;
+		}
+		
+		public int Count {
+			get {
+				IEnumerable ds = DataSource;
+
+				if (ds == null)
+					return 0;
+
+				bool onLastPage = OnLastPage;
+				int maxRows = MaximumRows;
+				
+				if (!onLastPage && maxRows >= 0)
+					return maxRows;
+
+				// LAMESPEC: MSDN says that DataSourceCount should be subtracted
+				// from StartRowIndex, but that would result in a negative number,
+				// which is not what we want.
+				return DataSourceCount - StartRowIndex;
+			}
+		}
+		
+		public IEnumerable DataSource {
+			get;
+			set;
+		}
+		
+		public int DataSourceCount {
+			get {
+				IEnumerable ds = DataSource;
+				if (ds == null)
+					return 0;
+
+				if (!(ds is ICollection))
+					throw new InvalidOperationException ("The data source object does not implement the System.Collections..::.ICollection interface.");
+
+				if (IsServerPagingEnabled)
+					return TotalRowCount;				
+
+				return ((ICollection) ds).Count;
+			}
+		}
+		
+		public bool IsReadOnly {
+			get { return false; }
+		}
+		
+		public bool IsServerPagingEnabled {
+			get { return AllowServerPaging; }
+		}
+		
+		public bool IsSynchronized {
+			get { return false; }
+		}
+		
+		public int MaximumRows {
+			get;
+			set;
+		}
+		
+		public int StartRowIndex {
+			get;
+			set;
+		}
+		
+		public object SyncRoot {
+			get { return this; }
+		}
+		
+		public int TotalRowCount {
+			get;
+			set;
+		}
+
+		bool OnLastPage {
+			get { return ((StartRowIndex + MaximumRows) >= DataSourceCount); }
+		}
+		
+	}
+}
+#endif

+ 48 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewSelectEventArgs.cs

@@ -0,0 +1,48 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewSelectEventArgs : CancelEventArgs
+	{
+		public ListViewSelectEventArgs (int newSelectedIndex)
+		{
+		}
+		
+		public int NewSelectedIndex {
+			get { throw new NotImplementedException (); }
+			set { }
+		}
+	}
+}
+#endif

+ 53 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewSortEventArgs.cs

@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewSortEventArgs : CancelEventArgs
+	{
+		public ListViewSortEventArgs (string sortExpression, SortDirection sortDirection)
+		{
+		}
+		
+		public SortDirection SortDirection {
+			get { throw new NotImplementedException (); }
+			set { }
+		}
+		
+		public string SortExpression {
+			get { throw new NotImplementedException (); }
+			set { }
+		}
+	}
+}
+#endif

+ 50 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewTableRow.cs

@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.ListViewTableRow
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2008 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+
+namespace System.Web.UI.WebControls
+{
+	internal class ListViewTableRow : HtmlTableRow
+	{
+		protected override ControlCollection CreateControlCollection ()
+		{
+			return new ControlCollection (this);
+		}
+		
+		protected internal override void Render (HtmlTextWriter writer)
+		{
+			RenderChildren (writer);
+		}
+	}
+}
+#endif

+ 60 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewUpdateEventArgs.cs

@@ -0,0 +1,60 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewUpdateEventArgs : CancelEventArgs
+	{
+		public ListViewUpdateEventArgs (int itemIndex)
+		{
+		}
+		
+		public int ItemIndex {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public IOrderedDictionary Keys {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public IOrderedDictionary NewValues {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public IOrderedDictionary OldValues {
+			get { throw new NotImplementedException (); }
+		}
+	}
+}
+#endif

+ 69 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListViewUpdatedEventArgs.cs

@@ -0,0 +1,69 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+	public class ListViewUpdatedEventArgs : EventArgs
+	{
+		public ListViewUpdatedEventArgs (int affectedRows, Exception exception)
+		{
+		}
+		
+		public int AffectedRows {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public Exception Exception {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public bool ExceptionHandled {
+			get { throw new NotImplementedException (); }
+			set { }
+		}
+		
+		public bool KeepInEditMode {
+			get { throw new NotImplementedException (); }
+			set { }
+		}
+		
+		public IOrderedDictionary NewValues {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public IOrderedDictionary OldValues {
+			get { throw new NotImplementedException (); }
+		}
+	}
+}
+#endif

+ 508 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/NextPreviousPagerField.cs

@@ -0,0 +1,508 @@
+//
+// System.Web.UI.WebControls.NextPreviousPagerField
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.ComponentModel;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+	[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	public class NextPreviousPagerField : DataPagerField
+	{
+		int _startRowIndex;
+		int _maximumRows;
+		int _totalRowCount;
+		int _fieldIndex;
+		
+		public NextPreviousPagerField ()
+		{
+		}
+
+		protected override void CopyProperties (DataPagerField newField)
+		{
+			base.CopyProperties (newField);
+
+			NextPreviousPagerField field = newField as NextPreviousPagerField;
+			if (field != null) {
+				field.ButtonCssClass = ButtonCssClass;
+				field.ButtonType = ButtonType;
+				field.FirstPageImageUrl = FirstPageImageUrl;
+				field.FirstPageText = FirstPageText;
+				field.LastPageImageUrl = LastPageImageUrl;
+				field.LastPageText = LastPageText;
+				field.NextPageImageUrl = NextPageImageUrl;
+				field.NextPageText = NextPageText;
+				field.PreviousPageImageUrl = PreviousPageImageUrl;
+				field.PreviousPageText = PreviousPageText;
+				field.ShowFirstPageButton = ShowFirstPageButton;
+				field.ShowLastPageButton = ShowLastPageButton;
+				field.ShowNextPageButton = ShowNextPageButton;
+				field.ShowPreviousPageButton = ShowPreviousPageButton;
+			}
+		}
+
+		// What's the fieldIndex used for?
+		public override void CreateDataPagers (DataPagerFieldItem container, int startRowIndex, int maximumRows, int totalRowCount, int fieldIndex)
+		{
+			_startRowIndex = startRowIndex;
+			_maximumRows = maximumRows;
+			_totalRowCount = totalRowCount;
+			_fieldIndex = fieldIndex;
+
+			bool queryMode = !String.IsNullOrEmpty (DataPager.QueryStringField);
+			bool setPagePropertiesNeeded = false;
+			
+			if (queryMode && !QueryStringHandled) {
+				QueryStringHandled = true;
+
+				// We need to calculate the new start index since it is probably out
+				// of date because the GET parameter with the page number hasn't
+				// been processed yet
+				int pageNumber = -1;
+				try {
+					pageNumber = Int32.Parse (QueryStringValue);
+				} catch {
+					// ignore
+				}
+
+				if (pageNumber >= 0) {
+					pageNumber--; // we're zero-based since we're calculating
+						      // the offset/index
+					if (pageNumber >= 0) {
+						// zero-based calculation again
+						int pageCount = (_totalRowCount - 1) / _maximumRows; 
+						if (pageNumber <= pageCount) {
+							_startRowIndex = pageNumber * _maximumRows;
+							setPagePropertiesNeeded = true;
+						}
+					}
+				}
+			}
+			
+			bool enablePrevFirst = _startRowIndex > _maximumRows;
+			bool enableNextLast = (_startRowIndex + _maximumRows) < _totalRowCount;
+			bool addNonBreakingSpace = RenderNonBreakingSpacesBetweenControls;
+
+			if (ShowFirstPageButton)
+				CreateButton (container, DataControlCommands.FirstPageCommandArgument, FirstPageText, FirstPageImageUrl, 0,
+					      queryMode, enablePrevFirst, addNonBreakingSpace);
+			
+			int newPageNum = -1;
+			
+			if (ShowNextPageButton) {
+				if (queryMode)
+					newPageNum = (_startRowIndex + _maximumRows) / _maximumRows;
+				
+				CreateButton (container, DataControlCommands.NextPageCommandArgument, NextPageText, NextPageImageUrl, newPageNum,
+					      queryMode, enableNextLast, addNonBreakingSpace);
+			}
+			
+			if (ShowLastPageButton) {
+				if (queryMode) {
+					newPageNum = _totalRowCount / _maximumRows;
+					if ((_totalRowCount % _maximumRows) == 0)
+						newPageNum--;
+				}
+				
+				CreateButton (container, DataControlCommands.LastPageCommandArgument, LastPageText, LastPageImageUrl, newPageNum,
+					      queryMode, enableNextLast, addNonBreakingSpace);
+			}
+			
+			if (ShowPreviousPageButton) {
+				if (queryMode)
+					newPageNum = (_startRowIndex / _maximumRows) - 1;
+				
+				CreateButton (container, DataControlCommands.PreviousPageCommandArgument, PreviousPageText, PreviousPageImageUrl, newPageNum,
+					      queryMode, enablePrevFirst, addNonBreakingSpace);
+			}
+			
+			if (setPagePropertiesNeeded)
+				DataPager.SetPageProperties (_startRowIndex, _maximumRows, true);
+		}
+
+		void CreateButton (DataPagerFieldItem container, string commandName, string text, string imageUrl, int pageNum, bool queryMode,
+				   bool enabled, bool addNonBreakingSpace)
+		{
+			WebControl ctl = null;
+			
+			if (queryMode) {
+				pageNum++;
+				HyperLink h = new HyperLink ();
+				h.Text = text;
+				h.ImageUrl = imageUrl;
+				h.Enabled = enabled;
+				h.NavigateUrl = GetQueryStringNavigateUrl (pageNum);
+				h.CssClass = ButtonCssClass;
+
+				ctl = h;
+			} else {
+				if (!enabled && RenderDisabledButtonsAsLabels) {
+					Label l = new Label ();
+					l.Text = text;
+					ctl = l;
+				} else {
+					switch (ButtonType) {
+						case ButtonType.Button:
+							ctl = new Button ();
+							break;
+
+						case ButtonType.Link:
+							ctl = new LinkButton ();
+							break;
+
+						case ButtonType.Image:
+							ImageButton btn = new ImageButton ();
+							btn.ImageUrl = imageUrl;
+							btn.AlternateText = text;
+							ctl = btn;
+							break;
+					}
+
+					if (ctl != null) {
+						ctl.Enabled = enabled;
+						((Button)ctl).CommandName = commandName;
+						ctl.CssClass = ButtonCssClass;
+					}
+				}
+			}
+
+			if (ctl != null) {
+				container.Controls.Add (ctl);
+				if (addNonBreakingSpace)
+					container.Controls.Add (new LiteralControl ("&nbsp;"));
+			}
+		}
+		
+		protected override DataPagerField CreateField ()
+		{
+			return new NextPreviousPagerField ();
+		}
+
+		public override bool Equals (object o)
+		{
+			NextPreviousPagerField field = o as NextPreviousPagerField;
+			if (field == null)
+				return false;
+			
+			// Compare using the properties that are copied in CopyProperties
+			if (field.ButtonCssClass != ButtonCssClass)
+				return false;
+
+			if (field.ButtonType != ButtonType)
+				return false;
+
+			if (field.FirstPageImageUrl != FirstPageImageUrl)
+				return false;
+			
+			if (field.FirstPageText != FirstPageText)
+				return false;
+			
+			if (field.LastPageImageUrl != LastPageImageUrl)
+				return false;
+			
+			if (field.LastPageText != LastPageText)
+				return false;
+			
+			if (field.NextPageImageUrl != NextPageImageUrl)
+				return false;
+			
+			if (field.NextPageText != NextPageText)
+				return false;
+			
+			if (field.PreviousPageImageUrl != PreviousPageImageUrl)
+				return false;
+			
+			if (field.PreviousPageText != PreviousPageText)
+				return false;
+			
+			if (field.ShowFirstPageButton != ShowFirstPageButton)
+				return false;
+			
+			if (field.ShowLastPageButton != ShowLastPageButton)
+				return false;
+			
+			if (field.ShowNextPageButton != ShowNextPageButton)
+				return false;
+			
+			if (field.ShowPreviousPageButton != ShowPreviousPageButton)
+				return false;
+
+			return true;
+		}
+
+		public override int GetHashCode ()
+		{
+			int ret = 0;
+
+			// Base the calculation on the properties that are copied in CopyProperties
+			ret |= ButtonCssClass.GetHashCode ();
+			ret |= ButtonType.GetHashCode ();
+			ret |= FirstPageImageUrl.GetHashCode ();
+			ret |= FirstPageText.GetHashCode ();
+			ret |= LastPageImageUrl.GetHashCode ();
+			ret |= LastPageText.GetHashCode ();
+			ret |= NextPageImageUrl.GetHashCode ();
+			ret |= NextPageText.GetHashCode ();
+			ret |= PreviousPageImageUrl.GetHashCode ();
+			ret |= PreviousPageText.GetHashCode ();
+			ret |= ShowFirstPageButton.GetHashCode ();
+			ret |= ShowLastPageButton.GetHashCode ();
+			ret |= ShowNextPageButton.GetHashCode ();
+			ret |= ShowPreviousPageButton.GetHashCode ();
+
+			return ret;
+		}
+
+		public override void HandleEvent (CommandEventArgs e)
+		{
+			string commandName = e.CommandName;
+			int newStartIndex = -1;
+			int pageSize = DataPager.PageSize;
+			
+			if (String.Compare (commandName, DataControlCommands.FirstPageCommandArgument, StringComparison.OrdinalIgnoreCase) == 0) {
+				newStartIndex = 0;
+			} else if (String.Compare (commandName, DataControlCommands.LastPageCommandArgument, StringComparison.OrdinalIgnoreCase) == 0) {
+				int lastPageMod = _totalRowCount % pageSize;
+				if (lastPageMod == 0)
+					newStartIndex = _totalRowCount - pageSize;
+				else
+					newStartIndex = _totalRowCount - lastPageMod;
+			} else if (String.Compare (commandName, DataControlCommands.NextPageCommandArgument, StringComparison.OrdinalIgnoreCase) == 0) {
+				newStartIndex = _startRowIndex + pageSize;
+				if (newStartIndex > _totalRowCount)
+					newStartIndex = _totalRowCount - pageSize;
+			} else if (String.Compare (commandName, DataControlCommands.PreviousPageCommandArgument, StringComparison.OrdinalIgnoreCase) == 0) {
+				newStartIndex = _startRowIndex - pageSize;
+				if (newStartIndex < 0)
+					newStartIndex = 0;
+			}
+
+			if (newStartIndex != -1)
+				DataPager.SetPageProperties (newStartIndex, pageSize, true);
+		}
+
+		public string ButtonCssClass {
+			get {
+				string s = ViewState ["ButtonCssClass"] as string;
+				if (s != null)
+					return s;
+
+				return String.Empty;
+			}
+			
+			set { ViewState ["ButtonCssClass"] = value; }
+		}
+
+		public ButtonType ButtonType {
+			get {
+				object o = ViewState ["ButtonType"];
+				if (o != null)
+					return (ButtonType) o;
+
+				return ButtonType.Link;
+			}
+			
+			set { ViewState ["ButtonType"] = value; }
+		}
+
+		public string FirstPageImageUrl {
+			get {
+				string s = ViewState ["FirstPageImageUrl"] as string;
+				if (s != null)
+					return s;
+
+				return String.Empty;
+			}
+			
+			set { ViewState ["FirstPageImageUrl"] = value; }
+		}
+
+		public string FirstPageText {
+			get {
+				string s = ViewState ["FirstPageText"] as string;
+				if (s != null)
+					return s;
+
+				return "First";
+			}
+			
+			set { ViewState ["FirstPageText"] = value; }
+		}
+
+		public string LastPageImageUrl {
+			get {
+				string s = ViewState ["LastPageImageUrl"] as string;
+				if (s != null)
+					return s;
+
+				return String.Empty;
+			}
+			
+			set { ViewState ["LastPageImageUrl"] = value; }
+		}
+
+		public string LastPageText {
+			get {
+				string s = ViewState ["LastPageText"] as string;
+				if (s != null)
+					return s;
+
+				return "Last";
+			}
+			
+			set { ViewState ["LastPageText"] = value; }
+		}
+
+		public string NextPageImageUrl {
+			get {
+				string s = ViewState ["NextPageImageUrl"] as string;
+				if (s != null)
+					return s;
+
+				return String.Empty;
+			}
+			
+			set { ViewState ["NextPageImageUrl"] = value; }
+		}
+
+		public string NextPageText {
+			get {
+				string s = ViewState ["NextPageText"] as string;
+				if (s != null)
+					return s;
+
+				return "Next";
+			}
+			
+			set { ViewState ["NextPageText"] = value; }
+		}
+
+		public string PreviousPageImageUrl {
+			get {
+				string s = ViewState ["PreviousPageImageUrl"] as string;
+				if (s != null)
+					return s;
+
+				return String.Empty;
+			}
+			
+			set { ViewState ["PreviousPageImageUrl"] = value; }
+		}
+
+		public string PreviousPageText {
+			get {
+				string s = ViewState ["PreviousPageText"] as string;
+				if (s != null)
+					return s;
+
+				return "Previous";
+			}
+			
+			set { ViewState ["PreviousPageText"] = value; }
+		}
+
+		public bool RenderDisabledButtonsAsLabels {
+			get {
+				object o = ViewState ["RenderDisabledButtonsAsLabels"];
+				if (o != null)
+					return (bool) o;
+
+				return false;
+			}
+			
+			set { ViewState ["RenderDisabledButtonsAsLabels"] = value; }
+		}
+
+		public bool RenderNonBreakingSpacesBetweenControls {
+			get {
+				object o = ViewState ["RenderNonBreakingSpacesBetweenControls"];
+				if (o != null)
+					return (bool) o;
+
+				return true;
+			}
+			
+			set { ViewState ["RenderNonBreakingSpacesBetweenControls"] = value; }
+		}
+
+		public bool ShowFirstPageButton {
+			get {
+				object o = ViewState ["ShowFirstPageButton"];
+				if (o != null)
+					return (bool) o;
+
+				return false;
+			}
+			
+			set { ViewState ["ShowFirstPageButton"] = value; }
+		}
+
+		public bool ShowLastPageButton {
+			get {
+				object o = ViewState ["ShowLastPageButton"];
+				if (o != null)
+					return (bool) o;
+
+				return false;
+			}
+			
+			set { ViewState ["ShowLastPageButton"] = value; }
+		}
+
+		public bool ShowNextPageButton {
+			get {
+				object o = ViewState ["ShowNextPageButton"];
+				if (o != null)
+					return (bool) o;
+
+				return true;
+			}
+			
+			set { ViewState ["ShowNextPageButton"] = value; }
+		}
+
+		public bool ShowPreviousPageButton {
+			get {
+				object o = ViewState ["ShowPreviousPageButton"];
+				if (o != null)
+					return (bool) o;
+
+				return true;
+			}
+			
+			set { ViewState ["ShowPreviousPageButton"] = value; }
+		}
+	}
+}
+#endif

+ 165 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/NumericPagerField.cs

@@ -0,0 +1,165 @@
+//
+// System.Web.UI.WebControls.NumericPagerField
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+	[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	public class NumericPagerField : DataPagerField
+	{
+		public NumericPagerField ()
+		{
+		}
+
+		protected override void CopyProperties (DataPagerField newField)
+		{
+		}
+
+		public override void CreateDataPagers (DataPagerFieldItem container, int startRowIndex, int maximumRows,
+						       int totalRowCount, int fieldIndex)
+		{
+		}
+
+		protected override DataPagerField CreateField ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		public override bool Equals (object o)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public override int GetHashCode ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		public override void HandleEvent (CommandEventArgs e)
+		{
+		}
+
+		public int ButtonCount {
+			get {
+				throw new NotImplementedException ();
+			}
+			
+			set {
+			}
+		}
+
+		public ButtonType ButtonType {
+			get {
+				throw new NotImplementedException ();
+			}
+			
+			set {
+			}
+		}
+
+		public string CurrentPageLabelCssClass {
+			get {
+				throw new NotImplementedException ();
+			}
+			
+			set {
+			}
+		}
+
+		public string NextPageImageUrl {
+			get {
+				throw new NotImplementedException ();
+			}
+			
+			set {
+			}
+		}
+
+		public string NextPageText {
+			get {
+				throw new NotImplementedException ();
+			}
+			
+			set {
+			}
+		}
+
+		public string NextPreviousButtonCssClass {
+			get {
+				throw new NotImplementedException ();
+			}
+			
+			set {
+			}
+		}
+
+		public string NumericButtonCssClass {
+			get {
+				throw new NotImplementedException ();
+			}
+			
+			set {
+			}
+		}
+
+		public string PreviousPageImageUrl {
+			get {
+				throw new NotImplementedException ();
+			}
+			
+			set {
+			}
+		}
+
+		public string PreviousPageText {
+			get {
+				throw new NotImplementedException ();
+			}
+			
+			set {
+			}
+		}
+
+		public bool RenderNonBreakingSpacesBetweenControls {
+			get {
+				throw new NotImplementedException ();
+			}
+			
+			set {
+			}
+		}
+	}
+}
+#endif

+ 66 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/PageEventArgs.cs

@@ -0,0 +1,66 @@
+//
+// System.Web.UI.WebControls.IPageableItemContainer
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+	[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	public class PageEventArgs : EventArgs
+	{
+		int startRowIndex;
+		int maximumRows;
+		int totalRowCount;
+		
+		public PageEventArgs(int startRowIndex, int maximumRows, int totalRowCount)
+		{
+			this.startRowIndex = startRowIndex;
+			this.maximumRows = maximumRows;
+			this.totalRowCount = totalRowCount;
+		}
+
+		public int MaximumRows {
+			get { return maximumRows; }
+		}
+
+		public int StartRowIndex {
+			get { return startRowIndex; }
+		}
+
+		public int TotalRowCount {
+			get { return totalRowCount; }
+		}
+	}
+}
+#endif

+ 50 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/PagePropertiesChangingEventArgs.cs

@@ -0,0 +1,50 @@
+//
+// System.Web.UI.WebControls.ListView
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+
+namespace System.Web.UI.WebControls
+{
+	public class PagePropertiesChangingEventArgs : EventArgs
+	{
+		public PagePropertiesChangingEventArgs (int startRowIndex, int maximumRows)
+		{
+		}
+		
+		public int MaximumRows {
+			get { throw new NotImplementedException (); }
+		}
+		
+		public int StartRowIndex {
+			get { throw new NotImplementedException (); }
+		}
+	}
+}
+#endif

+ 49 - 0
mcs/class/System.Web.Extensions/System.Web.UI.WebControls/TemplatePagerField.cs

@@ -0,0 +1,49 @@
+//
+// System.Web.UI.WebControls.TemplatePagerField
+//
+// Authors:
+//   Marek Habersack ([email protected])
+//
+// (C) 2007 Novell, Inc
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_3_5
+using System;
+using System.Security.Permissions;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+	[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+	public class TemplatePagerField : DataPagerField
+	{
+		public TemplatePagerField ()
+		{
+		}
+
+		
+	}
+}
+#endif