public static List<Field> BuildFieldsFromGrid(GridView grid)
 {
     List<Field> list = new List<Field>();
     foreach(GridColumn gc in grid.Columns)
     {
         if (gc.Visible)
         {
             Field field = new Field();
             field.CAPTION = gc.Caption;
             field.NAME = gc.FieldName;
             field.DATA_TYPE = gc.ColumnType.Name;
             field.TAG = gc.Tag != null ? gc.Tag.ToString() : "";
             list.Add(field);
         }
     }
     return list;
 }
 private void BuildFilterString_Object(QueryBuilder filter, Field field)
 {
     Control ctr = filter_panel.Controls[0];
     if (filter_type == 1)
     {
         CondText Text_ctr = (CondText)ctr;
         filter.addLike(field.NAME, Text_ctr.GiaTri.Text);
     }
     else if (filter_type == 2)
     {
         CondNumber So_ctr = (CondNumber)ctr;
         addNumFromTo(filter, field.NAME, So_ctr.SpinTu, So_ctr.SpinDen);
     }
     else if (filter_type == 3)
     {
         CondDate Ngay_ctr = (CondDate)ctr;
         filter.addDateFromTo(field.NAME, Ngay_ctr.DateTu.DateTime, Ngay_ctr.DateDen.DateTime);
     }
     else if (filter_type == 4)
     {
         CondComboBox Combo_ctr = (CondComboBox)ctr;
         filter.addID(field.NAME, Combo_ctr.ComboID._getSelectedID());
     }
 }