private ObjectDataSourceView GetView()
 {
     if (this._view == null)
     {
         this._view = new ObjectDataSourceView(this, "DefaultView", this.Context);
         if (base.IsTrackingViewState)
         {
             ((IStateManager)this._view).TrackViewState();
         }
     }
     return(this._view);
 }
        /// <devdoc>
        /// Dynamically creates the default (and only) ObjectDataSourceView on demand.
        /// </devdoc>
        private ObjectDataSourceView GetView()
        {
            if (_view == null)
            {
                _view = new ObjectDataSourceView(this, DefaultViewName, Context);

                if (IsTrackingViewState)
                {
                    ((IStateManager)_view).TrackViewState();
                }
            }

            return(_view);
        }
Ejemplo n.º 3
0
		public void CanRetrieveTotalRowCount () 
		{
			ObjectDataSource ds = new ObjectDataSource ();
			ObjectDataSourceView view = new ObjectDataSourceView (ds, "DefaultView", null);

			Assert.IsFalse (view.CanPage, "CanPage#1");
			Assert.IsTrue (view.CanRetrieveTotalRowCount, "CanRetrieveTotalRowCount#1");

			view.EnablePaging = true;
			Assert.IsTrue (view.CanPage, "CanPage#2");
			Assert.IsFalse (view.CanRetrieveTotalRowCount, "CanRetrieveTotalRowCount#2");

			view.SelectCountMethod = "SelectCountMethod";
			Assert.IsTrue (view.CanPage, "CanPage#3");
			Assert.IsTrue (view.CanRetrieveTotalRowCount, "CanRetrieveTotalRowCount#3");

			view.EnablePaging = false;
			Assert.IsFalse (view.CanPage, "CanPage#4");
			Assert.IsTrue (view.CanRetrieveTotalRowCount, "CanRetrieveTotalRowCount#4");
		}
Ejemplo n.º 4
0
		public void ViewState ()
		{
			// Note :
			// IStateManager implementation allows public access to control state
			// Nothing added to viewstate

			ObjectDataSourceView view;
			MyDataSource ds = new MyDataSource ();

			ds.ID = "ObjectDataSource2";
			ds.TypeName = "MonoTests.System.Web.UI.WebControls.DataSourceObject";
			ds.SelectMethod = "Select";
			ds.SelectCountMethod = "SelectCount";

			view = (ObjectDataSourceView) ds.DoGetView ("DefaultView");
			((IStateManager) view).TrackViewState ();

			view.ConflictDetection = ConflictOptions.CompareAllValues;
			view.ConvertNullToDBNull = true;
			view.DataObjectTypeName = "test";
			view.DeleteMethod = "test";
			view.EnablePaging = true;
			view.InsertMethod = "test";
			view.FilterExpression = "test";
			view.MaximumRowsParameterName = "test";
			view.SelectCountMethod = "test";
			view.SelectMethod = "test";
			view.OldValuesParameterFormatString = "test";
			view.StartRowIndexParameterName = "test";
			view.TypeName = "test";
			view.UpdateMethod = "test";

			object state = ((IStateManager) view).SaveViewState ();
			Assert.IsNull (state, "ViewState#1");

			ObjectDataSourceView copy = new ObjectDataSourceView (ds, "DefaultView", null);
			((IStateManager) copy).LoadViewState (state);

		}
        /// <devdoc>
        /// Dynamically creates the default (and only) ObjectDataSourceView on demand.
        /// </devdoc>
        private ObjectDataSourceView GetView() {
            if (_view == null) {
                _view = new ObjectDataSourceView(this, DefaultViewName, Context);

                if (IsTrackingViewState) {
                    ((IStateManager)_view).TrackViewState();
                }
            }

            return _view;
        }
 private ObjectDataSourceView GetView()
 {
     if (this._view == null)
     {
         this._view = new ObjectDataSourceView(this, "DefaultView", this.Context);
         if (base.IsTrackingViewState)
         {
             ((IStateManager) this._view).TrackViewState();
         }
     }
     return this._view;
 }