protected ReportTableRow CreateNewRow(int index, List <BaseReportCondition> reportConditions)
        {
            ReportTableRow             row = new ReportTableRow();
            TableCell                  cell;
            List <BaseReportCondition> items = new List <BaseReportCondition>();
            int i = 0;

            foreach (BaseReportCondition condition in reportConditions)
            {
                items.Add(condition);

                foreach (BaseReportCondition reportCondition in condition.GetVisualReportConditions())
                {
                    if (!reportCondition.Visible)
                    {
                        continue;
                    }
                    cell             = new TableCell();
                    cell.BorderWidth = 1;
                    Control columnFilter = (Control)reportCondition.ColumnFilter;
                    columnFilter.ID = string.Format("column_{0}_{1}", index, i++);
                    cell.Controls.Add(columnFilter);
                    row.Cells.Add(cell);
                }
            }
            cell             = new TableCell();
            cell.BorderWidth = 1;
            ImageButton button = new ImageButton();

            button.ID     = string.Format("delButton_{0}", index);
            button.Click += DeleteButton_OnClick;
            button.Attributes["index"] = index.ToString();
            button.ImageUrl            = Page.ClientScript.GetWebResourceUrl(GetType(), "Nat.Web.ReportManager.DeleteHS.png");

            cell.Controls.Add(button);
            row.Cells.Add(cell);
            row.ReportConditions = items;
            row.ImageButton      = button;
            return(row);
        }
        private void DeleteButton_OnClick(object sender, EventArgs e)
        {
            ImageButton btn = sender as ImageButton;

            if (btn != null)
            {
                int index = Convert.ToInt32(btn.Attributes["index"]);
                _table.Rows.RemoveAt(index);
                CountRows--;
                for (int rowIndex = index; rowIndex < _table.Rows.Count; rowIndex++)
                {
                    int            cellIndex = 0;
                    ReportTableRow row       = (ReportTableRow)_table.Rows[rowIndex];
                    row.ImageButton.ID = string.Format("delButton_{0}", rowIndex);
                    foreach (BaseReportCondition item in row.ReportConditions)
                    {
                        foreach (BaseReportCondition reportCondition in item.GetVisualReportConditions())
                        {
                            ((Control)reportCondition.ColumnFilter).ID = string.Format("column_{0}_{1}", rowIndex, cellIndex);
                        }
                    }
                }
            }
        }