How to represent data in a control with different column lengths in each row?

223 views Asked by At

I need to implement a user control with a datatable or something that you suggest for having different column length and it should be responsive. Every row in this table has at least 3 columns and there is no maximum value for column count. For instance, first row has 3 columns, second row has 5 columns, third row has 12 columns. However, I don't know the maximum column length for a single row. I thought that using data table is beneficial like

         DataTable dt = new DataTable();
            dt.Columns.Add("first column", typeof(string));
            dt.Columns.Add("second column", typeof(string));
            dt.Columns.Add("third column", typeof(List<string>));
            DataRow dr = dt.NewRow();
            dr[0] = "1";
            dr[1] = "a";
            dr[2] = new List<string>(){ "a","b","c","d"};
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr[0] = "2";
            dr[1] = "c";
            dr[2] = new List<string>() { "a", "b", "c"};
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr[0] = "3";
            dr[1] = "d";
            dr[2] = new List<string>() { "a", "b", "c","d","e" };
            dt.Rows.Add(dr);  
            gridControl1.DataSource = dt;

I used Devexpress GridView and I see below

this .

But I don't want to see like this. Is there any control that can represent this data like this ?

Thanks in advance !

1

There are 1 answers

1
Master Programmer On

Grid view used to display tables and table have fixed row and column

Only you can add maximum number of column as column and this type presenting grid view is not possible in any grid view.

To display table like this you can only use HTML preview in your software or use draw to create image like this this is not grid view at all