c#_Devexpress set datatable to gridControl

509 views Asked by At

i want to merger column in table to show example

NameEmp  |    CasualLeave    |     SickLeave     |     AnualLeave
         | auto  | Manual    |  auto  |  Manual  | auto  | manual
   epm1  |  1    |    1      |   2    |    0     |       |

i'm try read col painting and paint in TableGridView to do this but i can't understand so i use control grid view in dev Express, BandedGridView to design same table and when i set source for table BandedGridView it only set all dataTable for 1 column in BandedGridView

it like:

dt = new DataTable();
PjControl tk = new PjControl();
dt = tk.loadTimeWork(month);
gridControl1.DataSource = dt;

public DataTable loadTimeWork(int month)
        {
            conn = new SqlDBConnection();
            conn.connection();
            DataTable dt = new DataTable("tmp");
            SqlDataAdapter da = new SqlDataAdapter();

            SqlCommand cmd = new SqlCommand("getTimeworkLeave", conn.connection());
            cmd.Parameters.Add("@month", SqlDbType.Int).Value = month;
            cmd.CommandType = CommandType.StoredProcedure;
            da.SelectCommand = cmd;
            da.Fill(dt);
            conn.connection().Close();
            return dt;
        }

and that code output

    NameEmp                       |    CasualLeave    |     SickLeave     |     AnualLeave
Auto |auto   |manual| auto |...   | auto  | Manual    |  auto  |  Manual  | auto  | manual
emp1 |    1  |  1   |  2   |      |  null |     null  |        |          |       |   
     |       |      |      |      |       |           |        |          |       |  

i can use foreach datarow in datatable to set one by one row in GridControl but it spend 1 foreach

how to set datatable to GridControl but than easier? like add column except header

0

There are 0 answers