private void CreateDataPagersForQueryString(DataPagerFieldItem container, int fieldIndex)
        {
            QueryStringHandled = true;

            if (ShowFirstPageButton)
            {
                container.Controls.Add(CreateLink(FirstPageText, 0, FirstPageImageUrl, EnablePreviousPage));
                AddNonBreakingSpace(container);
            }

            if (ShowPreviousPageButton)
            {
                int pageIndex = (_startRowIndex / _maximumRows) - 1;
                container.Controls.Add(CreateLink(PreviousPageText, pageIndex, PreviousPageImageUrl, EnablePreviousPage));
                AddNonBreakingSpace(container);
            }

            if (ShowNextPageButton)
            {
                int pageIndex = (_startRowIndex + _maximumRows) / _maximumRows;
                container.Controls.Add(CreateLink(NextPageText, pageIndex, NextPageImageUrl, EnableNextPage));
                AddNonBreakingSpace(container);
            }

            if (ShowLastPageButton)
            {
                int pageIndex = (_totalRowCount / _maximumRows) - (_totalRowCount % _maximumRows == 0 ? 1 : 0);
                container.Controls.Add(CreateLink(LastPageText, pageIndex, LastPageImageUrl, EnableNextPage));
                AddNonBreakingSpace(container);
            }
        }
        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);
                controls.Add(control);
                if (dpf.Visible)
                {
                    dpf.CreateDataPagers(control, _startRowIndex, _maximumRows, _totalRowCount, _fields.IndexOf(dpf));
                    control.DataBind();
                }
            }

            _createPagerFieldsRunning = false;
        }
        private void CreateDataPagersForCommand(DataPagerFieldItem container, int fieldIndex)
        {
            if (ShowFirstPageButton)
            {
                container.Controls.Add(CreateControl(DataControlCommands.FirstPageCommandArgument, FirstPageText, fieldIndex, FirstPageImageUrl, EnablePreviousPage));
                AddNonBreakingSpace(container);
            }

            if (ShowPreviousPageButton)
            {
                container.Controls.Add(CreateControl(DataControlCommands.PreviousPageCommandArgument, PreviousPageText, fieldIndex, PreviousPageImageUrl, EnablePreviousPage));
                AddNonBreakingSpace(container);
            }

            if (ShowNextPageButton)
            {
                container.Controls.Add(CreateControl(DataControlCommands.NextPageCommandArgument, NextPageText, fieldIndex, NextPageImageUrl, EnableNextPage));
                AddNonBreakingSpace(container);
            }

            if (ShowLastPageButton)
            {
                container.Controls.Add(CreateControl(DataControlCommands.LastPageCommandArgument, LastPageText, fieldIndex, LastPageImageUrl, EnableNextPage));
                AddNonBreakingSpace(container);
            }
        }
 private void AddNonBreakingSpace(DataPagerFieldItem container)
 {
     if (RenderNonBreakingSpacesBetweenControls)
     {
         container.Controls.Add(new LiteralControl(" "));
     }
 }
Beispiel #5
0
		public override void CreateDataPagers (DataPagerFieldItem container, int startRowIndex, int maximumRows, int totalRowCount, int fieldIndex)
		{
			ITemplate pagerTemplate = PagerTemplate;
			if (pagerTemplate == null)
				return;

			pagerTemplate.InstantiateIn (container);
		}
Beispiel #6
0
 public DataPagerCommandEventArgs(DataPagerField pagerField, int totalRowCount, CommandEventArgs originalArgs, DataPagerFieldItem item)
     : base(originalArgs)
 {
     Item             = item;
     NewMaximumRows   = -1;
     NewStartRowIndex = -1;
     PagerField       = pagerField;
     TotalRowCount    = totalRowCount;
 }
		public DataPagerCommandEventArgs (DataPagerField pagerField, int totalRowCount, CommandEventArgs originalArgs, DataPagerFieldItem item)
			: base (originalArgs)
		{
			Item = item;
			NewMaximumRows = -1;
			NewStartRowIndex = -1;
			PagerField = pagerField;
			TotalRowCount = totalRowCount;
		}
		public override void CreateDataPagers (DataPagerFieldItem container, int startRowIndex, int maximumRows, int totalRowCount, int fieldIndex)
		{
			_startRowIndex = startRowIndex;
			_maximumRows = maximumRows;
			_totalRowCount = totalRowCount;
			_fieldIndex = fieldIndex;

			bool setPagePropertiesNeeded = false;
			bool queryMode = GetQueryModeStartRowIndex (_totalRowCount, _maximumRows, ref _startRowIndex, ref setPagePropertiesNeeded);
			bool addNonBreakingSpace = RenderNonBreakingSpacesBetweenControls;
			int buttonCount = ButtonCount;

			int totalPages = totalRowCount / maximumRows + (totalRowCount % maximumRows > 0 ? 1 : 0);
			int currentPage = startRowIndex == 0 ? 1 : (startRowIndex / maximumRows) + 1;
			int firstPage = ((startRowIndex / (maximumRows * buttonCount)) * buttonCount) + 1;
			int lastPage = firstPage + buttonCount - 1;
			
			bool showPreviousPage = firstPage > buttonCount;
			bool showNextPage = totalPages - firstPage >= buttonCount;

			if (lastPage > totalPages)
				lastPage = totalPages;

			int newPageNum = -1;
			if (showPreviousPage) {
				if (queryMode)
					newPageNum = (_startRowIndex / _maximumRows) - 1;
				
				CreateButton (container, DataControlCommands.PreviousPageCommandArgument, PreviousPageText, PreviousPageImageUrl,
					      NextPreviousButtonCssClass, newPageNum, queryMode, true, addNonBreakingSpace);
			}

			string numericButtonCssClass = NumericButtonCssClass;
			bool enabled;
			string pageString;
			while (firstPage <= lastPage) {
				enabled = firstPage != currentPage;
				pageString = firstPage.ToString (CultureInfo.InvariantCulture);
				CreateButton (container, pageString, pageString, String.Empty,
					      enabled ? numericButtonCssClass : CurrentPageLabelCssClass, firstPage,
					      queryMode, enabled, addNonBreakingSpace);
				firstPage++;
			}
			
			if (showNextPage) {
				if (queryMode)
					newPageNum = (_startRowIndex + _maximumRows) / _maximumRows;
				
				CreateButton (container, DataControlCommands.NextPageCommandArgument, NextPageText, NextPageImageUrl,
					      NextPreviousButtonCssClass, newPageNum, queryMode, true, addNonBreakingSpace);
			}

			if (setPagePropertiesNeeded)
				DataPager.SetPageProperties (_startRowIndex, _maximumRows, true);
		}
Beispiel #9
0
        public override void CreateDataPagers(DataPagerFieldItem container, int startRowIndex, int maximumRows, int totalRowCount, int fieldIndex)
        {
            _startRowIndex = startRowIndex;
            _maximumRows   = maximumRows;
            _totalRowCount = totalRowCount;

            if (_pagerTemplate != null)
            {
                _pagerTemplate.InstantiateIn(container);
            }
        }
        public override void CreateDataPagers(DataPagerFieldItem container, int startRowIndex, int maximumRows, int totalRowCount, int fieldIndex)
        {
            ITemplate pagerTemplate = PagerTemplate;

            if (pagerTemplate == null)
            {
                return;
            }

            pagerTemplate.InstantiateIn(container);
        }
        public override void CreateDataPagers(DataPagerFieldItem container, int startRowIndex, int maximumRows, int totalRowCount, int fieldIndex)
        {
            _startRowIndex = startRowIndex;
            _maximumRows   = maximumRows;
            _totalRowCount = totalRowCount;

            if (String.IsNullOrEmpty(DataPager.QueryStringField))
            {
                CreateDataPagersForCommand(container, fieldIndex);
            }
            else
            {
                CreateDataPagersForQueryString(container, fieldIndex);
            }
        }
		// 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 setPagePropertiesNeeded = false;
			bool queryMode = GetQueryModeStartRowIndex (_totalRowCount, _maximumRows, ref _startRowIndex, ref setPagePropertiesNeeded);
			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 (ShowPreviousPageButton) {
				if (queryMode)
					newPageNum = (_startRowIndex / _maximumRows) - 1;
				
				CreateButton (container, DataControlCommands.PreviousPageCommandArgument, PreviousPageText, PreviousPageImageUrl, newPageNum,
					      queryMode, enablePrevFirst, addNonBreakingSpace);
			}
			
			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 (setPagePropertiesNeeded)
				DataPager.SetPageProperties (_startRowIndex, _maximumRows, true);
		}
Beispiel #13
0
        protected override bool OnBubbleEvent(object source, EventArgs e)
        {
            DataPagerFieldCommandEventArgs cea = e as DataPagerFieldCommandEventArgs;
            bool handled = false;

            if (cea != null)
            {
                DataPagerFieldItem item = cea.Item;
                if (item != null && item.PagerField != null)
                {
                    item.PagerField.HandleEvent(cea);
                    handled = true;
                }
            }
            return(handled);
        }
        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);
        }
Beispiel #15
0
        public override void HandleEvent(CommandEventArgs e)
        {
            DataPagerFieldItem             item = null;
            DataPagerFieldCommandEventArgs cea  = e as DataPagerFieldCommandEventArgs;

            if (cea != null)
            {
                item = cea.Item;
            }

            DataPagerCommandEventArgs pagerEventArgs = new DataPagerCommandEventArgs(this, _totalRowCount, e, item);

            OnPagerCommand(pagerEventArgs);

            if (pagerEventArgs.NewStartRowIndex != -1)
            {
                DataPager.SetPageProperties(pagerEventArgs.NewStartRowIndex, pagerEventArgs.NewMaximumRows, true);
            }
        }
Beispiel #16
0
 protected virtual void CreatePagerFields()
 {
     _creatingPagerFields = true;
     Controls.Clear();
     if (_fields != null)
     {
         foreach (DataPagerField field in _fields)
         {
             DataPagerFieldItem fieldItem = new DataPagerFieldItem(field, this);
             Controls.Add(fieldItem);
             if (field.Visible)
             {
                 field.CreateDataPagers(fieldItem, _startRowIndex, _maximumRows, _totalRowCount, _fields.IndexOf(field));
                 fieldItem.DataBind();
             }
         }
     }
     _creatingPagerFields = false;
 }
        private void CreateDataPagersForQueryString(DataPagerFieldItem container, int fieldIndex)
        {
            int currentPageIndex = _startRowIndex / _maximumRows;

            QueryStringHandled = true;

            int firstButtonIndex = (_startRowIndex / (ButtonCount * _maximumRows)) * ButtonCount;
            int lastButtonIndex  = firstButtonIndex + ButtonCount - 1;
            int lastRecordIndex  = ((lastButtonIndex + 1) * _maximumRows) - 1;

            if (firstButtonIndex != 0)
            {
                container.Controls.Add(CreateNextPrevLink(PreviousPageText, firstButtonIndex - 1, PreviousPageImageUrl));
                AddNonBreakingSpace(container);
            }

            for (int i = 0; i < ButtonCount && _totalRowCount > ((i + firstButtonIndex) * _maximumRows); i++)
            {
                if (i + firstButtonIndex == currentPageIndex)
                {
                    Label pageNumber = new Label();
                    pageNumber.Text = (i + firstButtonIndex + 1).ToString(CultureInfo.InvariantCulture);
                    if (!String.IsNullOrEmpty(CurrentPageLabelCssClass))
                    {
                        pageNumber.CssClass = CurrentPageLabelCssClass;
                    }
                    container.Controls.Add(pageNumber);
                }
                else
                {
                    container.Controls.Add(CreateNumericLink(i + firstButtonIndex));
                }
                AddNonBreakingSpace(container);
            }

            if (lastRecordIndex < _totalRowCount - 1)
            {
                AddNonBreakingSpace(container);
                container.Controls.Add(CreateNextPrevLink(NextPageText, firstButtonIndex + ButtonCount, NextPageImageUrl));
                AddNonBreakingSpace(container);
            }
        }
 protected virtual void CreatePagerFields() {
     _creatingPagerFields = true;
     Controls.Clear();
     if (_fields != null) {
         foreach (DataPagerField field in _fields) {
             DataPagerFieldItem fieldItem = new DataPagerFieldItem(field, this);
             Controls.Add(fieldItem);
             if (field.Visible) {
                 field.CreateDataPagers(fieldItem, _startRowIndex, _maximumRows, _totalRowCount, _fields.IndexOf(field));
                 fieldItem.DataBind();
             }
         }
     }
     _creatingPagerFields = false;
 }
 private void AddNonBreakingSpace(DataPagerFieldItem container) {
     if (RenderNonBreakingSpacesBetweenControls) {
         container.Controls.Add(new LiteralControl("&nbsp;"));
     }
 }
 public DataPagerCommandEventArgs(DataPagerField pagerField, int totalRowCount, CommandEventArgs originalArgs, DataPagerFieldItem item) : base(originalArgs)
 {
     _pagerField    = pagerField;
     _totalRowCount = totalRowCount;
     _item          = item;
 }
Beispiel #21
0
        void CreateButton(DataPagerFieldItem container, string commandName, string text, string imageUrl, string cssClass, int pageNum,
                          bool queryMode, bool enabled, bool addNonBreakingSpace, bool isPageNumber)
        {
            WebControl ctl = null;

            if (queryMode)
            {
                if (isPageNumber && !enabled)
                {
                    var span = new Label();
                    span.Text     = text;
                    span.CssClass = cssClass;
                    ctl           = span;
                }
                else
                {
                    HyperLink h = new HyperLink();
                    h.Text        = text;
                    h.ImageUrl    = imageUrl;
                    h.Enabled     = enabled;
                    h.NavigateUrl = GetQueryStringNavigateUrl(pageNum);
                    h.CssClass    = cssClass;
                    ctl           = h;
                }
            }
            else
            {
                if (!enabled)
                {
                    Label l = new Label();
                    l.Text     = text;
                    l.CssClass = cssClass;
                    ctl        = l;
                }
                else
                {
                    switch (ButtonType)
                    {
                    case ButtonType.Button:
                        Button btn = new Button();
                        btn.CommandName     = commandName;
                        btn.CommandArgument = pageNum.ToString();
                        btn.Text            = text;
                        break;

                    case ButtonType.Link:
                        LinkButton lbtn = new LinkButton();
                        lbtn.CommandName     = commandName;
                        lbtn.CommandArgument = pageNum.ToString();
                        lbtn.Text            = text;
                        ctl = lbtn;
                        break;

                    case ButtonType.Image:
                        ImageButton ibtn = new ImageButton();
                        ibtn.CommandName     = commandName;
                        ibtn.CommandArgument = pageNum.ToString();
                        ibtn.ImageUrl        = imageUrl;
                        ibtn.AlternateText   = text;
                        ctl = ibtn;
                        break;
                    }

                    if (ctl != null)
                    {
                        ctl.CssClass = cssClass;
                    }
                }
            }

            if (ctl != null)
            {
                container.Controls.Add(ctl);
                if (addNonBreakingSpace)
                {
                    container.Controls.Add(new LiteralControl("&nbsp;"));
                }
            }
        }
Beispiel #22
0
        public override void CreateDataPagers(DataPagerFieldItem container, int startrow, int rowsperpage, int totalrows, int fieldIndex)
        {
            startRowIndex = startrow;
            maximumRows = rowsperpage;
            totalRowCount = totalrows;

            if (string.IsNullOrEmpty(DataPager.QueryStringField))
                CreateDataPagersForCommand(container, fieldIndex);
            else
                CreateDataPagersForQueryString(container, fieldIndex);
        }
Beispiel #23
0
        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:
                        Button btn = new Button();
                        btn.CommandName = commandName;
                        btn.Text        = text;
                        ctl             = btn;
                        break;

                    case ButtonType.Link:
                        LinkButton lbtn = new LinkButton();
                        lbtn.CommandName = commandName;
                        lbtn.Text        = text;
                        ctl = lbtn;
                        break;

                    case ButtonType.Image:
                        ImageButton ibtn = new ImageButton();
                        ibtn.CommandName   = commandName;
                        ibtn.ImageUrl      = imageUrl;
                        ibtn.AlternateText = text;
                        ctl = ibtn;
                        break;
                    }

                    if (ctl != null)
                    {
                        ctl.Enabled  = enabled;
                        ctl.CssClass = ButtonCssClass;
                    }
                }
            }

            if (ctl != null)
            {
                container.Controls.Add(ctl);
                if (addNonBreakingSpace)
                {
                    container.Controls.Add(new LiteralControl("&nbsp;"));
                }
            }
        }
Beispiel #24
0
        /// <summary>
        /// Creates the go to tex box.
        /// </summary>
        /// <param name="container">The container.</param>
        private void CreateGoToTexBox(DataPagerFieldItem container)
        {
            Label label = new Label();
            label.Text = "Go to: ";
            container.Controls.Add(label);

            ButtonTextBox goToTextBox = new ButtonTextBox();

            goToTextBox.CommandName = "GoToItem";
            goToTextBox.Width = new Unit("20px");
            container.Controls.Add(goToTextBox);

            this.AddNonBreakingSpace(container);
            this.AddNonBreakingSpace(container);
        }
        private void CreateDataPagersForCommand(DataPagerFieldItem container, int fieldIndex) {
            if (ShowFirstPageButton) {
                container.Controls.Add(CreateControl(DataControlCommands.FirstPageCommandArgument, FirstPageText, fieldIndex, FirstPageImageUrl, EnablePreviousPage));
                AddNonBreakingSpace(container);
            }

            if (ShowPreviousPageButton) {
                container.Controls.Add(CreateControl(DataControlCommands.PreviousPageCommandArgument, PreviousPageText, fieldIndex, PreviousPageImageUrl, EnablePreviousPage));
                AddNonBreakingSpace(container);
            }

            if (ShowNextPageButton) {
                container.Controls.Add(CreateControl(DataControlCommands.NextPageCommandArgument, NextPageText, fieldIndex, NextPageImageUrl, EnableNextPage));
                AddNonBreakingSpace(container);
            }

            if (ShowLastPageButton) {
                container.Controls.Add(CreateControl(DataControlCommands.LastPageCommandArgument, LastPageText, fieldIndex, LastPageImageUrl, EnableNextPage));
                AddNonBreakingSpace(container);
            }
        }
Beispiel #26
0
        /// <summary>
        /// Creates the data pagers for command.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="fieldIndex">Index of the field.</param>
        private void CreateDataPagersForCommand(DataPagerFieldItem container, int fieldIndex)
        {
            //Goto item texbox
            //this.CreateGoToTexBox(container);

            //Control used to set the page size.
            this.CreatePageSizeControl(container);

            //Set of records - total records
            this.CreateLabelRecordControl(container);

            //First button
            if (this._showFirstPage)
            {
                container.Controls.Add(this.CreateControl("First", this.FirstPageText, fieldIndex, this.FirstPageImageUrl, this._showFirstPage));
                this.AddNonBreakingSpace(container);
            }

            //Previous button
            if (this._showPreviousPage)
            {
                container.Controls.Add(this.CreateControl("Prev", this.PreviousPageText, fieldIndex, this.PreviousPageImageUrl, this._showPreviousPage));
                this.AddNonBreakingSpace(container);
            }

            //Next button
            if (this._showNextPage)
            {
                container.Controls.Add(this.CreateControl("Next", this.NextPageText, fieldIndex, this.NextPageImageUrl, this._showNextPage));
                this.AddNonBreakingSpace(container);
            }

            if (this._showLastPage)
            {
                container.Controls.Add(this.CreateControl("Last", this.LastPageText, fieldIndex, this.LastPageImageUrl, this._showLastPage));
                this.AddNonBreakingSpace(container);
            }
        }
Beispiel #27
0
        /// <summary>
        /// Creates the data pagers for query string.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="fieldIndex">Index of the field.</param>
        private void CreateDataPagersForQueryString(DataPagerFieldItem container, int fieldIndex)
        {
            bool validPageIndex = false;
            if (!base.QueryStringHandled)
            {
                int num;
                base.QueryStringHandled = true;
                if (int.TryParse(base.QueryStringValue, out num))
                {
                    num--;
                    int currentPageIndex = this._startRowIndex / this._maximumRows;
                    int maxPageIndex = (this._totalRowCount - 1) / this._maximumRows;
                    if ((num >= 0) && (num <= maxPageIndex))
                    {
                        this._startRowIndex = num * this._maximumRows;
                        validPageIndex = true;
                    }
                }
            }

            //Goto item texbox
            this.CreateGoToTexBox(container);

            //Control used to set the page size.
            this.CreatePageSizeControl(container);

            //Set of records - total records
            this.CreateLabelRecordControl(container);

            if (this._showPreviousPage)
            {
                int pageIndex = (this._startRowIndex / this._maximumRows) - 1;
                container.Controls.Add(this.CreateLink(this.PreviousPageText, pageIndex, this.PreviousPageImageUrl, this.EnablePreviousPage));
                this.AddNonBreakingSpace(container);
            }
            if (this._showNextPage)
            {
                int num4 = (this._startRowIndex + this._maximumRows) / this._maximumRows;
                container.Controls.Add(this.CreateLink(this.NextPageText, num4, this.NextPageImageUrl, this.EnableNextPage));
                this.AddNonBreakingSpace(container);
            }
            if (this._showFirstPage)
            {
                container.Controls.Add(this.CreateLink(this.FirstPageText, 0, this.FirstPageImageUrl, true));
                this.AddNonBreakingSpace(container);
            }
            if (this._showLastPage)
            {
                container.Controls.Add(this.CreateLink(this.LastPageText, _totalRowCount, this.LastPageImageUrl, true));
                this.AddNonBreakingSpace(container);
            }
            if (validPageIndex)
            {
                base.DataPager.SetPageProperties(this._startRowIndex, this._maximumRows, true);
            }
        }
Beispiel #28
0
 public abstract void CreateDataPagers(DataPagerFieldItem container, int startRowIndex, int maximumRows,
                                       int totalRowCount, int fieldIndex);
        private void CreateDataPagersForQueryString(DataPagerFieldItem container, int fieldIndex)
        {
            int currentPageIndex = _startRowIndex / _maximumRows;
            bool resetProperties = false;
            if (!QueryStringHandled)
            {
                int currentQSPageIndex;
                QueryStringHandled = true;
                bool parsed = Int32.TryParse(QueryStringValue, out currentQSPageIndex);
                if (parsed)
                {
                    currentQSPageIndex--;//convert page number to page index.
                    int highestPageIndex = (_totalRowCount - 1) / _maximumRows;
                    if ((currentQSPageIndex >= 0) && (currentQSPageIndex <= highestPageIndex))
                    {
                        currentPageIndex = currentQSPageIndex;
                        _startRowIndex = (currentPageIndex * _maximumRows);
                        resetProperties = true;
                    }
                }
            }

            int firstButtonIndex = (_startRowIndex / (ButtonCount * _maximumRows)) * ButtonCount;
            int lastButtonIndex = firstButtonIndex + ButtonCount - 1;
            int lastRecordIndex = ((lastButtonIndex + 1) * _maximumRows) - 1;

            if (firstButtonIndex != 0)
            {
                container.Controls.Add(CreateNextPrevLink(PreviousPageText, firstButtonIndex - 1, PreviousPageImageUrl));
                AddNonBreakingSpace(container);
            }

            for (int i = 0; i < ButtonCount && _totalRowCount > ((i + firstButtonIndex) * _maximumRows); i++)
            {
                if (i + firstButtonIndex == currentPageIndex)
                {
                    Label pageNumber = new Label();
                    pageNumber.Text = (i + firstButtonIndex + 1).ToString(CultureInfo.InvariantCulture);
                    if (!String.IsNullOrEmpty(CurrentPageLabelCssClass))
                    {
                        pageNumber.CssClass = CurrentPageLabelCssClass;
                    }
                    container.Controls.Add(pageNumber);
                }
                else
                {
                    container.Controls.Add(CreateNumericLink(i + firstButtonIndex));
                }
                AddNonBreakingSpace(container);
            }

            if (lastRecordIndex < _totalRowCount - 1)
            {
                AddNonBreakingSpace(container);
                container.Controls.Add(CreateNextPrevLink(NextPageText, firstButtonIndex + ButtonCount, NextPageImageUrl));
                AddNonBreakingSpace(container);
            }

            if (resetProperties)
            {
                DataPager.SetPageProperties(_startRowIndex, _maximumRows, true);
            }
        }
        private void CreateDataPagersForCommand(DataPagerFieldItem container, int fieldIndex)
        {
            int currentPageIndex = _startRowIndex / _maximumRows;
            int firstButtonIndex = (_startRowIndex / (ButtonCount * _maximumRows)) * ButtonCount;
            int lastButtonIndex = firstButtonIndex + ButtonCount - 1;
            int lastRecordIndex = ((lastButtonIndex + 1) * _maximumRows) - 1;


            container.Controls.Add(new LiteralControl("<div class=\"grid-footer-left pull-left\">"));

            //Set of records - total records
            CreateLabelRecordControl(container);

            //Control used to set the page size.
            CreatePageSizeControl(container);

            container.Controls.Add(new LiteralControl("</div>"));

            container.Controls.Add(new LiteralControl("<ul class=\"pagination pull-right\">"));

            if (firstButtonIndex != 0)
            {
                container.Controls.Add(new LiteralControl("<li>"));
                container.Controls.Add(CreateNextPrevButton(PreviousPageText, DataControlCommands.PreviousPageCommandArgument, fieldIndex.ToString(CultureInfo.InvariantCulture), PreviousPageImageUrl));
                container.Controls.Add(new LiteralControl("</li>"));
            }

            for (int i = 0; i < ButtonCount && _totalRowCount > ((i + firstButtonIndex) * _maximumRows); i++)
            {
                if (i + firstButtonIndex == currentPageIndex)
                {
                    //Label pageNumber = new Label();
                    //pageNumber.Text = (i + firstButtonIndex + 1).ToString(CultureInfo.InvariantCulture);
                    //if (!String.IsNullOrEmpty(CurrentPageLabelCssClass))
                    //{
                    //    pageNumber.CssClass = CurrentPageLabelCssClass;
                    //}
                    container.Controls.Add(new LiteralControl("<li class=\"active\">"));
                    container.Controls.Add(new LiteralControl(string.Format("<span>{0}<span class=\"sr-only\">(current)</span></span>", i + firstButtonIndex + 1)));
                    container.Controls.Add(new LiteralControl("</li>"));
                }
                else
                {
                    container.Controls.Add(new LiteralControl("<li>"));
                    container.Controls.Add(CreateNumericButton((i + firstButtonIndex + 1).ToString(CultureInfo.InvariantCulture), fieldIndex.ToString(CultureInfo.InvariantCulture), (i + firstButtonIndex).ToString(CultureInfo.InvariantCulture)));
                    container.Controls.Add(new LiteralControl("</li>")); 
                }
            }

            if (lastRecordIndex < _totalRowCount - 1)
            {
                container.Controls.Add(new LiteralControl("<li>"));
                container.Controls.Add(CreateNextPrevButton(NextPageText, DataControlCommands.NextPageCommandArgument, fieldIndex.ToString(CultureInfo.InvariantCulture), NextPageImageUrl));
                container.Controls.Add(new LiteralControl("</li>"));
            }

            container.Controls.Add(new LiteralControl("</ul>"));

           
        }
        private void CreateDataPagersForQueryString(DataPagerFieldItem container, int fieldIndex) {
            int currentPageIndex = _startRowIndex / _maximumRows;
            QueryStringHandled = true;
           
            int firstButtonIndex = (_startRowIndex / (ButtonCount * _maximumRows)) * ButtonCount;
            int lastButtonIndex = firstButtonIndex + ButtonCount - 1;
            int lastRecordIndex = ((lastButtonIndex + 1) * _maximumRows) - 1;

            if (firstButtonIndex != 0) {
                container.Controls.Add(CreateNextPrevLink(PreviousPageText, firstButtonIndex - 1, PreviousPageImageUrl));
                AddNonBreakingSpace(container);
            }

            for (int i = 0; i < ButtonCount && _totalRowCount > ((i + firstButtonIndex) * _maximumRows); i++) {
                if (i + firstButtonIndex == currentPageIndex) {
                    Label pageNumber = new Label();
                    pageNumber.Text = (i + firstButtonIndex + 1).ToString(CultureInfo.InvariantCulture);
                    if (!String.IsNullOrEmpty(CurrentPageLabelCssClass)) {
                        pageNumber.CssClass = CurrentPageLabelCssClass;
                    }
                    container.Controls.Add(pageNumber);
                }
                else {
                    container.Controls.Add(CreateNumericLink(i + firstButtonIndex));
                }
                AddNonBreakingSpace(container);
            }

            if (lastRecordIndex < _totalRowCount - 1) {
                AddNonBreakingSpace(container);
                container.Controls.Add(CreateNextPrevLink(NextPageText, firstButtonIndex + ButtonCount, NextPageImageUrl));
                AddNonBreakingSpace(container);
            }
        }
        private void CreateDataPagersForQueryString(DataPagerFieldItem container, int fieldIndex) {
            QueryStringHandled = true;
            
            if (ShowFirstPageButton) {
                container.Controls.Add(CreateLink(FirstPageText, 0, FirstPageImageUrl, EnablePreviousPage));
                AddNonBreakingSpace(container);
            }

            if (ShowPreviousPageButton) {
                int pageIndex = (_startRowIndex / _maximumRows) - 1;
                container.Controls.Add(CreateLink(PreviousPageText, pageIndex, PreviousPageImageUrl, EnablePreviousPage));
                AddNonBreakingSpace(container);
            }

            if (ShowNextPageButton) {
                int pageIndex = (_startRowIndex + _maximumRows) / _maximumRows;
                container.Controls.Add(CreateLink(NextPageText, pageIndex, NextPageImageUrl, EnableNextPage));
                AddNonBreakingSpace(container);
            }

            if (ShowLastPageButton) {
                int pageIndex = (_totalRowCount / _maximumRows) - (_totalRowCount % _maximumRows == 0 ? 1 : 0);
                container.Controls.Add(CreateLink(LastPageText, pageIndex, LastPageImageUrl, EnableNextPage));
                AddNonBreakingSpace(container);
            }
        }
        /// <summary>
        /// Creates the page size control.
        /// </summary>
        /// <param name="container">The container.</param>
        private void CreatePageSizeControl(DataPagerFieldItem container)
        {
            var pageSizeDropDownList = new ButtonDropDownList { CommandName = "UpdatePageSize", CssClass = "form-control"};

            pageSizeDropDownList.Items.Add(new ListItem("5", "5"));
            pageSizeDropDownList.Items.Add(new ListItem("10", "10"));
            pageSizeDropDownList.Items.Add(new ListItem("15", "15"));
            pageSizeDropDownList.Items.Add(new ListItem("25", "25"));
            pageSizeDropDownList.Items.Add(new ListItem("50", "50"));
            pageSizeDropDownList.Items.Add(new ListItem("75", "75"));
            pageSizeDropDownList.Items.Add(new ListItem("100", "100"));

            var pageSizeItem = pageSizeDropDownList.Items.FindByValue(DataPager.PageSize.ToString());

            if (pageSizeItem == null)
            {
                pageSizeItem = new ListItem(DataPager.PageSize.ToString(), DataPager.PageSize.ToString());
                pageSizeDropDownList.Items.Insert(0, pageSizeItem);
            }

            pageSizeItem.Selected = true;
            container.Controls.Add(pageSizeDropDownList);
            
            container.Controls.Add(new LiteralControl(string.Format("<span>{0}</span>", _PerPage)));
        }
Beispiel #34
0
        /// <summary>
        /// Creates the page size control.
        /// </summary>
        /// <param name="container">The container.</param>
        private void CreatePageSizeControl(DataPagerFieldItem container)
        {
            container.Controls.Add(new LiteralControl("Show rows: "));

            ButtonDropDownList pageSizeDropDownList = new ButtonDropDownList();

            pageSizeDropDownList.CommandName = "UpdatePageSize";

            pageSizeDropDownList.Items.Add(new ListItem("5", "5"));
            pageSizeDropDownList.Items.Add(new ListItem("10", "10"));
            pageSizeDropDownList.Items.Add(new ListItem("15", "15"));
            pageSizeDropDownList.Items.Add(new ListItem("25", "25"));
            pageSizeDropDownList.Items.Add(new ListItem("50", "50"));
            pageSizeDropDownList.Items.Add(new ListItem("75", "75"));
            pageSizeDropDownList.Items.Add(new ListItem("100", "100"));

            ListItem pageSizeItem = pageSizeDropDownList.Items.FindByValue(base.DataPager.PageSize.ToString());

            if (pageSizeItem == null)
            {
                pageSizeItem = new ListItem(base.DataPager.PageSize.ToString(), base.DataPager.PageSize.ToString());
                pageSizeDropDownList.Items.Insert(0, pageSizeItem);
            }

            pageSizeItem.Selected = true;
            container.Controls.Add(pageSizeDropDownList);

            this.AddNonBreakingSpace(container);
            this.AddNonBreakingSpace(container);
        }
		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:
							Button btn = new Button ();
							btn.CommandName = commandName;
							btn.Text = text;
							ctl = btn;
							break;

						case ButtonType.Link:
							LinkButton lbtn = new LinkButton ();
							lbtn.CommandName = commandName;
							lbtn.Text = text;
							ctl = lbtn;
							break;

						case ButtonType.Image:
							ImageButton ibtn = new ImageButton ();
							ibtn.CommandName = commandName;
							ibtn.ImageUrl = imageUrl;
							ibtn.AlternateText = text;
							ctl = ibtn;
							break;
					}

					if (ctl != null) {
						ctl.Enabled = enabled;
						ctl.CssClass = ButtonCssClass;
					}
				}
			}

			if (ctl != null) {
				container.Controls.Add (ctl);
				if (addNonBreakingSpace)
					container.Controls.Add (new LiteralControl ("&nbsp;"));
			}
		}
 public DataPagerFieldCommandEventArgs(DataPagerFieldItem item, object commandSource, CommandEventArgs originalArgs) : base(originalArgs) {
     _item = item;
     _commandSource = commandSource;
 }
Beispiel #37
0
		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);
				controls.Add (control);
				if (dpf.Visible) {
					dpf.CreateDataPagers (control, _startRowIndex, _maximumRows, _totalRowCount, _fields.IndexOf (dpf));
					control.DataBind ();
				}
			}

			_createPagerFieldsRunning = false;
		}
 public DataPagerCommandEventArgs(DataPagerField pagerField, int totalRowCount, CommandEventArgs originalArgs, DataPagerFieldItem item) : base(originalArgs) {
     _pagerField = pagerField;
     _totalRowCount = totalRowCount;
     _item = item;
 }
Beispiel #39
0
        // 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 setPagePropertiesNeeded = false;
            bool queryMode           = GetQueryModeStartRowIndex(_totalRowCount, _maximumRows, ref _startRowIndex, ref setPagePropertiesNeeded);
            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 (ShowPreviousPageButton)
            {
                if (queryMode)
                {
                    newPageNum = (_startRowIndex / _maximumRows) - 1;
                }

                CreateButton(container, DataControlCommands.PreviousPageCommandArgument, PreviousPageText, PreviousPageImageUrl, newPageNum,
                             queryMode, enablePrevFirst, addNonBreakingSpace);
            }

            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 (setPagePropertiesNeeded)
            {
                DataPager.SetPageProperties(_startRowIndex, _maximumRows, true);
            }
        }
Beispiel #40
0
 public DataPagerFieldCommandEventArgs(DataPagerFieldItem item, object commandSource, CommandEventArgs originalArgs)
     : base(originalArgs)
 {
     Item          = item;
     CommandSource = commandSource;
 }
Beispiel #41
0
		void CreateButton (DataPagerFieldItem container, string commandName, string text, string imageUrl, string cssClass, int pageNum,
				   bool queryMode, bool enabled, bool addNonBreakingSpace, bool isPageNumber)
		{
			WebControl ctl = null;
			
			if (queryMode) {
				if (isPageNumber && !enabled) {
					var span = new Label ();
					span.Text = text;
					span.CssClass = cssClass;
					ctl = span;
				} else {
					HyperLink h = new HyperLink ();
					h.Text = text;
					h.ImageUrl = imageUrl;
					h.Enabled = enabled;
					h.NavigateUrl = GetQueryStringNavigateUrl (pageNum);
					h.CssClass = cssClass;
					ctl = h;
				}
			} else {
				if (!enabled) {
					Label l = new Label ();
					l.Text = text;
					l.CssClass = cssClass;
					ctl = l;
				} else {
					switch (ButtonType) {
						case ButtonType.Button:
							Button btn = new Button ();
							btn.CommandName = commandName;
							btn.CommandArgument = pageNum.ToString ();
							btn.Text = text;
							break;

						case ButtonType.Link:
							LinkButton lbtn = new LinkButton ();
							lbtn.CommandName = commandName;
							lbtn.CommandArgument = pageNum.ToString ();
							lbtn.Text = text;
							ctl = lbtn;
							break;

						case ButtonType.Image:
							ImageButton ibtn = new ImageButton ();
							ibtn.CommandName = commandName;
							ibtn.CommandArgument = pageNum.ToString ();
							ibtn.ImageUrl = imageUrl;
							ibtn.AlternateText = text;
							ctl = ibtn;
							break;
					}

					if (ctl != null)
						ctl.CssClass = cssClass;
				}
			}

			if (ctl != null) {
				container.Controls.Add (ctl);
				if (addNonBreakingSpace)
					container.Controls.Add (new LiteralControl ("&nbsp;"));
			}
		}
 private void CreateDataPagersForCommand(DataPagerFieldItem container, int fieldIndex)
 {
     if (this.ShowFirstPageButton)
     {
         container.Controls.Add(this.CreateControl("First", "icon-double-angle-left", fieldIndex, this.EnablePreviousPage));
     }
     if (this.ShowPreviousPageButton)
     {
         container.Controls.Add(this.CreateControl("Prev", "icon-angle-left", fieldIndex, this.EnablePreviousPage));
     }
     if (this.ShowNextPageButton)
     {
         container.Controls.Add(this.CreateControl("Next", "icon-angle-right", fieldIndex, this.EnableNextPage));
     }
     if (this.ShowLastPageButton)
     {
         container.Controls.Add(this.CreateControl("Last", "icon-double-angle-right", fieldIndex, this.EnableNextPage));
     }
 }
Beispiel #43
0
        public override void CreateDataPagers(DataPagerFieldItem container, int startRowIndex, int maximumRows, int totalRowCount, int fieldIndex)
        {
            _startRowIndex = startRowIndex;
            _maximumRows   = maximumRows;
            _totalRowCount = totalRowCount;
            _fieldIndex    = fieldIndex;

            bool setPagePropertiesNeeded = false;
            bool queryMode           = GetQueryModeStartRowIndex(_totalRowCount, _maximumRows, ref _startRowIndex, ref setPagePropertiesNeeded);
            bool addNonBreakingSpace = RenderNonBreakingSpacesBetweenControls;
            int  buttonCount         = ButtonCount;
            int  totalPages          = totalRowCount / maximumRows + (totalRowCount % maximumRows > 0 ? 1 : 0);
            int  currentPage         = startRowIndex == 0 ? 1 : (startRowIndex / maximumRows) + 1;
            int  activePage          = ((startRowIndex / (maximumRows * buttonCount)) * buttonCount) + 1;
            int  lastPage            = activePage + buttonCount - 1;

            bool showPreviousPage = activePage > buttonCount;
            bool showNextPage     = totalPages - activePage >= buttonCount;

            if (lastPage > totalPages)
            {
                lastPage = totalPages;
            }

            int newPageNum;

            if (showPreviousPage)
            {
                newPageNum = activePage - 1;
                if (newPageNum < 1)
                {
                    newPageNum = 1;
                }

                CreateButton(container, DataControlCommands.PreviousPageCommandArgument, PreviousPageText, PreviousPageImageUrl,
                             NextPreviousButtonCssClass, newPageNum, queryMode, true, addNonBreakingSpace, false);
            }

            string numericButtonCssClass = NumericButtonCssClass;
            bool   enabled;
            string pageString;

            while (activePage <= lastPage)
            {
                enabled    = activePage != currentPage;
                pageString = activePage.ToString(CultureInfo.InvariantCulture);
                CreateButton(container, pageString, pageString, String.Empty,
                             enabled ? numericButtonCssClass : CurrentPageLabelCssClass, activePage,
                             queryMode, enabled, addNonBreakingSpace, true);
                activePage++;
            }
            if (showNextPage && addNonBreakingSpace)
            {
                container.Controls.Add(new LiteralControl("&nbsp;"));
            }

            if (showNextPage)
            {
                CreateButton(container, DataControlCommands.NextPageCommandArgument, NextPageText, NextPageImageUrl,
                             NextPreviousButtonCssClass, activePage, queryMode, true, addNonBreakingSpace, false);
            }

            if (setPagePropertiesNeeded)
            {
                DataPager.SetPageProperties(_startRowIndex, _maximumRows, true);
            }
        }
 private void CreateDataPagersForQueryString(DataPagerFieldItem container, int fieldIndex)
 {
     bool flag = false;
     if (!base.QueryStringHandled)
     {
         int num;
         base.QueryStringHandled = true;
         if (int.TryParse(base.QueryStringValue, out num))
         {
             num--;
             int num1 = this._startRowIndex / this._maximumRows;
             int num2 = (this._totalRowCount - 1) / this._maximumRows;
             if ((num >= 0) && (num <= num2))
             {
                 this._startRowIndex = num * this._maximumRows;
                 flag = true;
             }
         }
     }
     if (this.ShowFirstPageButton)
     {
         container.Controls.Add(this.CreateLink("icon-double-angle-left", 0, this.EnablePreviousPage));
     }
     if (this.ShowPreviousPageButton)
     {
         int pageIndex = (this._startRowIndex / this._maximumRows) - 1;
         container.Controls.Add(this.CreateLink("icon-angle-left", pageIndex, this.EnablePreviousPage));
     }
     if (this.ShowNextPageButton)
     {
         int num4 = (this._startRowIndex + this._maximumRows) / this._maximumRows;
         container.Controls.Add(this.CreateLink("icon-angle-right", num4, this.EnableNextPage));
     }
     if (this.ShowLastPageButton)
     {
         int num5 = (this._totalRowCount / this._maximumRows) - (((this._totalRowCount % this._maximumRows) == 0) ? 1 : 0);
         container.Controls.Add(this.CreateLink("icon-double-angle-right", num5, this.EnableNextPage));
     }
     if (flag)
     {
         base.DataPager.SetPageProperties(this._startRowIndex, this._maximumRows, true);
     }
 }
Beispiel #45
0
		public abstract void CreateDataPagers (DataPagerFieldItem container, int startRowIndex, int maximumRows,
						       int totalRowCount, int fieldIndex);
        private void CreateDataPagersForCommand(DataPagerFieldItem container, int fieldIndex)
        {
            int aPageSize = this._startRowIndex / this._maximumRows;
            int num2 = (this._startRowIndex / (this.ButtonCount * this._maximumRows)) * this.ButtonCount;
            int num3 = (num2 + this.ButtonCount) - 1;
            int num4 = ((num3 + 1) * this._maximumRows) - 1;
            if (num2 != 0)
            {
                container.Controls.Add(this.CreateNextPrevButton("icon-angle-left", "Prev", fieldIndex.ToString(CultureInfo.InvariantCulture)));
            }
            for (int i = 0; (i < this.ButtonCount) && (this._totalRowCount > ((i + num2) * this._maximumRows)); i++)
            {
                if (i + num2 == aPageSize)
                {
                    container.Controls.Add(CreateCurrentPageLabel(i + num2));
                }
                else
                {
                    int num7 = (i + num2) + 1;
                    int num8 = i + num2;
                    container.Controls.Add(this.CreateNumericButton(num7.ToString(CultureInfo.InvariantCulture), fieldIndex.ToString(CultureInfo.InvariantCulture), num8.ToString(CultureInfo.InvariantCulture)));
                }

            }
            if (num4 < (this._totalRowCount - 1))
            {

                container.Controls.Add(this.CreateNextPrevButton("icon-angle-right", "Next", fieldIndex.ToString(CultureInfo.InvariantCulture)));

            }
        }
        public override void CreateDataPagers(DataPagerFieldItem container, int startRowIndex, int maximumRows, int totalRowCount, int fieldIndex) {
            _startRowIndex = startRowIndex;
            _maximumRows = maximumRows;
            _totalRowCount = totalRowCount;

            if (String.IsNullOrEmpty(DataPager.QueryStringField)) {
                CreateDataPagersForCommand(container, fieldIndex);
            }
            else {
                CreateDataPagersForQueryString(container, fieldIndex);
            }
        }
        private void CreateDataPagersForQueryString(DataPagerFieldItem container, int fieldIndex)
        {
            int pageIndex = this._startRowIndex / this._maximumRows;
            bool flag = false;
            if (!base.QueryStringHandled)
            {
                int requestPage;
                base.QueryStringHandled = true;
                if (int.TryParse(base.QueryStringValue, out requestPage))
                {
                    requestPage--;
                    int pageCount = (this._totalRowCount - 1) / this._maximumRows;
                    if ((requestPage >= 0) && (requestPage <= pageCount))
                    {
                        pageIndex = requestPage;
                        this._startRowIndex = pageIndex * this._maximumRows;
                        flag = true;
                    }
                }
            }
            int firstPageIndex = (this._startRowIndex / (this.ButtonCount * this._maximumRows)) * this.ButtonCount;
            int lastPage = (firstPageIndex + this.ButtonCount) - 1;
            int lastVisiblePagerRow = ((lastPage + 1) * this._maximumRows) - 1;
            if (firstPageIndex != 0)
            {
                container.Controls.Add(this.CreateNextPrevLink("icon-angle-left", firstPageIndex - 1));

            }
            for (int i = 0; (i < this.ButtonCount) && (this._totalRowCount > ((i + firstPageIndex) * this._maximumRows)); i++)
            {
                if ((i + firstPageIndex) == pageIndex)
                {
                    container.Controls.Add(CreateCurrentPageLabel(i + firstPageIndex));
                }
                else
                {
                    container.Controls.Add(this.CreateNumericLink(i + firstPageIndex));
                }

            }
            if (lastVisiblePagerRow < (this._totalRowCount - 1))
            {
                container.Controls.Add(this.CreateNextPrevLink("icon-angle-right", firstPageIndex + this.ButtonCount));
            }
            if (flag)
            {
                base.DataPager.SetPageProperties(this._startRowIndex, this._maximumRows, true);
            }
        }
Beispiel #49
0
        /// <summary>
        /// Creates the label record control.
        /// </summary>
        /// <param name="container">The container.</param>
        private void CreateLabelRecordControl(DataPagerFieldItem container)
        {
            int endRowIndex = this._startRowIndex + base.DataPager.PageSize;

            if (endRowIndex > this._totalRowCount)
                endRowIndex = this._totalRowCount;

            container.Controls.Add(new LiteralControl(string.Format("{0} - {1} of {2}", this._startRowIndex + 1, endRowIndex, this._totalRowCount)));

            this.AddNonBreakingSpace(container);
            this.AddNonBreakingSpace(container);
            this.AddNonBreakingSpace(container);
        }
        /// <summary>
        /// Creates the label record control.
        /// </summary>
        /// <param name="container">The container.</param>
        private void CreateLabelRecordControl(DataPagerFieldItem container)
        {
            int endRowIndex = _startRowIndex + DataPager.PageSize;

            if (endRowIndex > _totalRowCount)
                endRowIndex = _totalRowCount;

            container.Controls.Add(new LiteralControl("<span>"));
            container.Controls.Add(new LiteralControl(string.Format(_rowXofY, _startRowIndex + 1, endRowIndex, _totalRowCount)));
            container.Controls.Add(new LiteralControl("</span>"));
        }