Hi,
I am Kuldeep, trying to create dynamic report thru this code but show
blank.
Please help or suggest me, what I am making mistake in it. Is it right
code? And where I can find its solution or help.
private void table1_ItemDataBinding(object sender, EventArgs e)
{
dbCon = new SqlConnection
(ConfigurationManager.ConnectionStrings["abc"].ConnectionString);
dbCon.Open();
dbCon.Close();
SqlDataAdapter adapter = new SqlDataAdapter("spOrder",
dbCon);
Telerik.Reporting.Processing.Table processingTable = (sender
as Telerik.Reporting.Processing.Table);
Telerik.Reporting.Table table1 = new
Telerik.Reporting.Table();
DataTable dt = new DataTable();
adapter.Fill(dt);
processingTable.DataSource = dt;
Telerik.Reporting.HtmlTextBox textboxGroup;
Telerik.Reporting.HtmlTextBox textBoxTable;
table1.ColumnGroups.Clear();
table1.Body.Columns.Clear();
table1.Body.Rows.Clear();
int i = 0;
foreach (DataColumn dc in dt.Columns)
{
Telerik.Reporting.TableGroup tableGroupColumn = new
Telerik.Reporting.TableGroup();
table1.ColumnGroups.Add(tableGroupColumn);
table1.Body.Columns.Add(new
Telerik.Reporting.TableBodyColumn(Unit.Inch(1)));
textboxGroup = new Telerik.Reporting.HtmlTextBox();
textboxGroup.Style.BorderColor.Default = Color.Black;
textboxGroup.Style.BorderStyle.Default =
BorderType.Solid;
textboxGroup.Value = dc.ColumnName.ToString();
textboxGroup.Size = new SizeU(Unit.Inch(1.1), Unit.Inch
(0.3));
tableGroupColumn.ReportItem = textboxGroup;
textBoxTable = new Telerik.Reporting.HtmlTextBox();
textBoxTable.Style.BorderColor.Default = Color.Black;
textBoxTable.Style.BorderStyle.Default =
BorderType.Solid;
textBoxTable.Value = "=Fields." + dc.ColumnName;
textBoxTable.Size = new SizeU(Unit.Inch(1.1), Unit.Inch
(0.3));
table1.Body.SetCellContent(0, i++, textBoxTable);
table1.Items.AddRange(new ReportItemBase[] {
textBoxTable, textboxGroup });
}
}
Thanks and Regards!
Kuldeep Dwivedi
I am Kuldeep, trying to create dynamic report thru this code but show
blank.
Please help or suggest me, what I am making mistake in it. Is it right
code? And where I can find its solution or help.
private void table1_ItemDataBinding(object sender, EventArgs e)
{
dbCon = new SqlConnection
(ConfigurationManager.ConnectionStrings["abc"].ConnectionString);
dbCon.Open();
dbCon.Close();
SqlDataAdapter adapter = new SqlDataAdapter("spOrder",
dbCon);
Telerik.Reporting.Processing.Table processingTable = (sender
as Telerik.Reporting.Processing.Table);
Telerik.Reporting.Table table1 = new
Telerik.Reporting.Table();
DataTable dt = new DataTable();
adapter.Fill(dt);
processingTable.DataSource = dt;
Telerik.Reporting.HtmlTextBox textboxGroup;
Telerik.Reporting.HtmlTextBox textBoxTable;
table1.ColumnGroups.Clear();
table1.Body.Columns.Clear();
table1.Body.Rows.Clear();
int i = 0;
foreach (DataColumn dc in dt.Columns)
{
Telerik.Reporting.TableGroup tableGroupColumn = new
Telerik.Reporting.TableGroup();
table1.ColumnGroups.Add(tableGroupColumn);
table1.Body.Columns.Add(new
Telerik.Reporting.TableBodyColumn(Unit.Inch(1)));
textboxGroup = new Telerik.Reporting.HtmlTextBox();
textboxGroup.Style.BorderColor.Default = Color.Black;
textboxGroup.Style.BorderStyle.Default =
BorderType.Solid;
textboxGroup.Value = dc.ColumnName.ToString();
textboxGroup.Size = new SizeU(Unit.Inch(1.1), Unit.Inch
(0.3));
tableGroupColumn.ReportItem = textboxGroup;
textBoxTable = new Telerik.Reporting.HtmlTextBox();
textBoxTable.Style.BorderColor.Default = Color.Black;
textBoxTable.Style.BorderStyle.Default =
BorderType.Solid;
textBoxTable.Value = "=Fields." + dc.ColumnName;
textBoxTable.Size = new SizeU(Unit.Inch(1.1), Unit.Inch
(0.3));
table1.Body.SetCellContent(0, i++, textBoxTable);
table1.Items.AddRange(new ReportItemBase[] {
textBoxTable, textboxGroup });
}
}
Thanks and Regards!
Kuldeep Dwivedi