예제 #1
0
		public GridController(GridView grid, Pager pager, BusinessQuery businessQuery)
			: this(grid, pager, businessQuery, null)
		{
		}
예제 #2
0
		public GridController(GridView grid, Pager pager,
		                      BusinessQuery businessQuery, Type entityBaseType)
		{
			IsRequiredToBindGrid = false;
			if (grid == null)
				throw new ArgumentNullException("grid");

			if (businessQuery == null)
				throw new ArgumentNullException("businessQuery");

			_businessQuery = businessQuery;
			this.entityBaseType = entityBaseType;

			_grid = grid;
			_childControls.Add(grid);

			if (pager != null)
			{
				_pager = pager;
				//if (pager is Control) 
				_childControls.Add(pager);
			}

			InitializeGridSettings();
			InitializeQuerySettings();
			InitializePagerSettings();
		}
예제 #3
0
		protected override void OnInit(EventArgs e)
		{
			Control control;

			if (_grid == null)
			{
				control = FindNestedControl(_gridId);

				if (control != null && control is GridView)
					_grid = control as GridView;
				else throw new Exception(string.Format("GridView '{0}' not found", _gridId));
			}

			if (_grid is VoteHolderGridView)
			{
				GridBindingStart += ((VoteHolderGridView) _grid).OnGridBindingStart;
			}

			_businessQuery = BusinessQuery.CreateInstance(_queryType);

			if (!ReferenceEquals(QueryCreated, null))
				QueryCreated();

			if (_pager == null && _pagerId != null)
			{
				control = FindControl(_pagerId);
				if (control != null && control is Pager)
				{
					_pager = control as Pager;
					_pager.StateID = GetStateID();
					_childControls.Add(_pager);
				}
				else throw new Exception(string.Format("Pager '{0}' not found", _pagerId));
			}

			InitializeGridSettings();
			InitializeQuerySettings();

			if (IsPagingEnabled && Page.IsPostBack)
				_pager.PageSize = _businessQuery.Query.PageSettings.PageSize;

			InitializePagerSettings();

			if (!Page.IsPostBack)
				IsRequiredToBindGrid = true;
		}