public IndCatGridPager(GridPagingManager pagingManager, IndCatGrid ownerGrid)
        {
            try
            {
                ControlHierarchyManager = new ControlHierarchyManager(this);

                this.PagingManager = pagingManager;
                this.owner         = ownerGrid;

                if (pagingManager != null)
                {
                    this.RowCount = pagingManager.DataSourceCount;
                }
                this.PageSize = owner.PageSize;

                lblItems.ID = "lblItems";

                CreateControls();
            }
            catch (IndException ex)
            {
                ControlHierarchyManager.ReportError(ex);
                return;
            }
            catch (Exception ex)
            {
                ControlHierarchyManager.ReportError(new IndException(ex));
                return;
            }
        }
        /// <summary>
        /// Event handler for the click event of Clear Filter button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void clearFilterButton_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                //For each data bound and displayed column in the grid, clear its filter
                foreach (GridColumn c in this.Owner.Columns)
                {
                    IndGridBoundColumn col = c as IndGridBoundColumn;
                    if (col != null && col.Display)
                    {
                        col.CurrentFilterFunction = GridKnownFunction.NoFilter;
                        col.CurrentFilterValue    = String.Empty;
                    }
                }

                IndCatGrid parentGrid = (IndCatGrid)this.Owner.OwnerGrid;


                parentGrid.IndFilterExpression = String.Empty;
                parentGrid.IndFilterItem       = new IndFilterItem();

                parentGrid.Rebind();
            }
            catch (IndException ex)
            {
                ControlHierarchyManager.ReportError(ex);
                return;
            }
            catch (Exception ex)
            {
                ControlHierarchyManager.ReportError(new IndException(ex));
                return;
            }
        }
Beispiel #3
0
        private void filterButton_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                //StringBuilder filterExpression = new StringBuilder();
                ((IndCatGrid)this.Owner.OwnerGrid).IndFilterItem = new IndFilterItem();

                foreach (GridColumn c in this.Owner.Columns)
                {
                    IndGridBoundColumn col = c as IndGridBoundColumn;
                    string             comparerStart;
                    string             comparerEnd;
                    GridKnownFunction  function;
                    if (col != null && col.Display)
                    {
                        SetFilterParameters(col, out comparerStart, out comparerEnd, out function);

                        if (col.Cell.Controls.Count > 2)
                        {
                            FilterSpecialColumn(col, ((IndCatGrid)this.Owner.OwnerGrid).IndFilterItem, comparerStart, comparerEnd, function);
                        }
                        else
                        {
                            TextBox t = (TextBox)col.Cell.Controls[0];
                            decimal value;
                            if (IsColumnNumeric(col) && decimal.TryParse(t.Text, out value) == false)
                            {
                                col.CurrentFilterValue = String.Empty;
                                continue;
                            }
                            FilterCommonColumn(col, t.Text.Replace("'", "''"), ((IndCatGrid)this.Owner.OwnerGrid).IndFilterItem, comparerStart, comparerEnd, function);
                        }
                    }
                }

                IndCatGrid parentGrid = (IndCatGrid)this.Owner.OwnerGrid;

                if (parentGrid.IndFilterItem.FilterExpression.Length > 0)
                {
                    parentGrid.IndFilterItem.FilterExpression.Append(")");
                }
                parentGrid.IndFilterExpression = parentGrid.IndFilterItem.FilterExpression.ToString();


                this.Owner.OwnerGrid.Rebind();
            }
            catch (IndException ex)
            {
                ControlHierarchyManager.ReportError(ex);
                return;
            }
            catch (Exception ex)
            {
                ControlHierarchyManager.ReportError(new IndException(ex));
                return;
            }
        }