4

I want to show the table horizontally like this:

| data1 | data2 | data3 | data4 | ....

| data5 | data6 | ....

For more information, I am using visual studio 2010. and it will go to new line

I saw similar question here but it goes to new page instead of new line

Thanks for advance

Community
  • 1
  • 1
John Nguyen
  • 711
  • 6
  • 21

2 Answers2

2

in the rdl file or rdlc file in reportproperties set Columns to number of horizontal column you want to show enter image description here

for example you want to show 3 column show data and then go to next row

column1 | column2  | column3
column4 | column6  | column6

in report properties you set columns 3 and set report size width, size of column1 data automatically show in 3 column now you can use this report as sub report in other report

Mehdi Haghshenas
  • 2,433
  • 1
  • 16
  • 35
2

you must crate data table for this

for example for 3 column you Crate DataTable for this purpose

DataTable dt=new DataTable();
dt.Columns.Add("Data1");
dt.Columns.Add("Data2");
dt.Columns.Add("Data3");
DataRow drow=dt.NewRow();
for(int i=1;i<olddt.Rows.Count;i++)
{
  if(i%3==0 && i!=0)
  {
     dt.Rows.Add(drow); 
     drow=dt.NewRow();
  }
  if(i%3==0)
  {
    drow[0]=olddt[i][Column].ToString();
  }
  if(i%3==1)
  {
     drow[1]=olddt[i][Column].ToString();
  }
  if(i%3==2)
  {
    drow[2]=olddt[i][Column].ToString();
  }
}

in this example oldDt is your old data

Mehdi Haghshenas
  • 2,433
  • 1
  • 16
  • 35