so i am dynamically generating columns as part of sql query. I will have several tables as part of the result set and i need to bind all the tables to the report except the first table
i have used the code provied by telerik team for dynamically creating the tables for report, in addition to that i have created a panel class to create panel's dynalically
my code is this:
objDS is my data set
for (int i = 1; i <= objDS.Tables.Count-1; i++)
{
string strTableName = "Table" + Convert.ToString(i);
string strPanelName = "Panel" + Convert.ToString(i);
// Creating a dynamic panel for adding the Table.
var panel = MyClass.Panel.CreatePanel(strPanelName);
//creating the dynamic table for each table from the result set
var table = MyClass.Table.CreateTable(strTableName,
unitType: UnitType.Pixel,
locationX: 1,
locationY: 1,
width: 200,
height: 20,
rowHeight: 20,
dataTable: objDS.Tables[i]);
//Creating the columns dynamically
for (int k = 0; k <= objDS.Tables[i].Columns.Count - 1; k++)
{
table.WithColumn(objDS.Tables[i].Columns[k].ToString(),objDS.Tables[i].Columns[k].ToString(), 120);
}
// Creating the header group and body group data dynamically
for (int k = 0; k <= objDS.Tables[i].Columns.Count - 1; k++)
{
table.HeaderTextBoxes[objDS.Tables[i].Columns[k].ToString()].Style.BackgroundColor = Color.YellowGreen;
table.HeaderTextBoxes[objDS.Tables[i].Columns[k].ToString()].Style.BorderStyle.Default = BorderType.Solid;
table.BodyTextBoxes[objDS.Tables[i].Columns[k].ToString()].Style.BackgroundColor = Color.Yellow;
table.BodyTextBoxes[objDS.Tables[i].Columns[k].ToString()].Style.BorderStyle.Default = BorderType.Solid;
}
//adding the dynamically created table to the dynamically created panel.
panel.Items.Add(table);
//adding the panel along with table to the static panel created from report designer
this.reportPanel.Items.Add(panel);
The reason why i am creating dynamic panels is i dont know how many tables i will get as part of result set and i dont dont even know how many columns each table contains i.e. 1st table may have only 5 columns and the Nth table may have 10 columns. And i dont even know the position of the Dynamically created table to place in the report.
after table is generated i am adding the table to the dynamically created panel and all the dynamically created panels i am adding them to the panel which is from Reporting front end.
the code is getting executed perfectly can see the columns created and data binded with no exceptions, but in the report the table is showing this error
"An error has occurred while processing Table 'Table1': Missing operator before 'Required' operand"
no clue about this error, need help on this or if there is some other alrernative approach for my requirement please suggest.
Thanks,
NeelaKrishna