title: Generating Table in Telerik Report Viewer Programmatically
body: <p>I am trying to generate a telerik report table dynamically. Actually, after lots of efforts besides surfing the web I have come to the following code which works fine but not presenting the desired output. Here is the code:</p>
  
  <pre><code>private void table1_ItemDataBinding(object sender, EventArgs e)
      {
          // Get data and bind it to the table
          var processingTable = (sender as Telerik.Reporting.Processing.Table);
          var data = GenerateTable(DomainClass.GetCurrentAsset());
          if (processingTable != null) processingTable.DataSource = data;
  
          // Better clear table before binding
          table1.ColumnGroups.Clear();
          table1.Body.Columns.Clear();
          table1.Body.Rows.Clear();
  
          HtmlTextBox txtGroup;
          HtmlTextBox txtTable;
          //int rowIndex = 0;
  
          for (int i = 0; i &lt;= data.Columns.Count - 1; i++)
          {
              var tableGroupColumn = new TableGroup();
              table1.ColumnGroups.Add(item: tableGroupColumn);
  
              txtGroup = new HtmlTextBox
                             {
                                 Size = new SizeU(Unit.Inch(2.1), Unit.Inch(0.3)),
                                 Value = data.Columns[i].ColumnName,
                                 Style =
                                     {
                                         BorderStyle = { Default = BorderType.Solid },
                                         BorderColor = { Default = Color.Black }
                                     },
                             };
              tableGroupColumn.ReportItem = txtGroup;
  
              txtTable = new HtmlTextBox()
                             {
                                 Size = new SizeU(Unit.Inch(2.2), Unit.Inch(0.3)),
                                 Value = "=Fields." + data.Columns[i].ColumnName,
                                 //Value = data.Rows[rowIndex][i].ToString(),
                                 Style =
                                     {
                                         BorderStyle = { Default = BorderType.Solid },
                                         BorderColor = { Default = Color.Black }
                                     }
                             };
  
              table1.Body.SetCellContent(0, columnIndex: i, item: txtTable);
              //rowIndex++;
              table1.Items.AddRange(items: new ReportItemBase[] { txtTable, txtGroup });
          }
      }
  </code></pre>
  
  <p>Here is a picture of DataTable which contains the table data:</p>
  
  <p><img src="https://i.stack.imgur.com/G5AQg.jpg" alt="Data Table Image of the Report"></p>
  
  <p>Finally, the current out put which is of course not what needed:</p>
  
  <p><img src="https://i.stack.imgur.com/srThe.jpg" alt="Report Result (Not Desired)"></p>
  
  <p><strong>So the problem is;</strong> The Account_Price column does not display the Prices, though retrieved from the data store and can be seen in the data table picture above. </p>
  
  <p>I have traced line by line of the code and could find out the prices as tracing the code. But I have no idea why they are not shown in the browser.</p>
  
  <p>Hope any one could help me,
  Thank you very much</p>