protected void Btn_Save_Click(object sender, EventArgs e)
        {
            FrmReportFields frmReportFields = new FrmReportFields();

            frmReportFields.RetrieveByAttr(FrmReportFieldAttr.FK_MapData, this.FK_MapData);
            foreach (FrmReportField item in frmReportFields)
            {
                TextBox tb = this.Pub1.GetTextBoxByID("TB_" + item.KeyOfEn);
                item.Name = tb.Text;

                tb           = this.Pub1.GetTextBoxByID("TB_" + item.KeyOfEn + "_width");
                item.UIWidth = tb.Text;

                tb       = this.Pub1.GetTextBoxByID("TB_" + item.KeyOfEn + "_Idx");
                item.Idx = int.Parse(tb.Text);

                CheckBox cb = this.Pub1.GetCBByID("CB_" + item.KeyOfEn);
                item.UIVisible = cb.Checked ? false : true;
                item.Update();
            }
            this.Response.Redirect("Frm_ColsLabel.aspx?FK_MapData=" + this.FK_MapData, true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Pub1.AddTable("width=90% align=center");
            this.Pub1.AddCaptionLeft("请选择要显示的字段,然后点保存按钮.");
            MapAttrs    mattrs = new MapAttrs();
            QueryObject qo     = new QueryObject(mattrs);

            qo.AddWhere(MapAttrAttr.FK_MapData, this.FK_MapData);
            qo.addOrderBy(MapAttrAttr.X, MapAttrAttr.Y);
            qo.DoQuery();

            //已设置
            FrmReportFields reportFields = new FrmReportFields();

            reportFields.RetrieveByAttr(FrmReportFieldAttr.FK_MapData, FK_MapData);

            int  cols = 4; //定义显示列数 从0开始。
            int  idx  = -1;
            bool is1  = false;

            foreach (MapAttr attr in mattrs)
            {
                idx++;
                if (idx == 0)
                {
                    is1 = this.Pub1.AddTR(is1);
                }

                CheckBox cb = new CheckBox();
                cb.ID      = "CB_" + attr.KeyOfEn;
                cb.Text    = attr.Name + "(" + attr.KeyOfEn + ")";
                cb.Checked = reportFields.Contains(FrmReportFieldAttr.KeyOfEn, attr.KeyOfEn);
                this.Pub1.AddTD(cb);

                if (idx == cols - 1)
                {
                    idx = -1;
                    this.Pub1.AddTREnd();
                }
            }
            while (idx != -1)
            {
                idx++;
                if (idx == cols - 1)
                {
                    idx = -1;
                    this.Pub1.AddTD();
                    this.Pub1.AddTREnd();
                }
                else
                {
                    this.Pub1.AddTD();
                }
            }
            CheckBox cbAll = new CheckBox();

            cbAll.ID              = "CB_CheckedAll";
            cbAll.Text            = "全选";
            cbAll.AutoPostBack    = true;
            cbAll.Checked         = IsChecked == "true" ? true : false;
            cbAll.CheckedChanged += new EventHandler(cbAll_CheckedChanged);
            this.Pub1.AddTR();
            this.Pub1.AddTD("colspan=4", cbAll);
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
        }