This is a migrated thread and some comments may be shown as answers.

Exception throw when binding datatable with email addresses within the rows to Table.DataSource

1 Answer 91 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paulino De Assis Fong
Top achievements
Rank 1
Paulino De Assis Fong asked on 28 Sep 2012, 09:50 AM
Hi,

I am following the example "AutoGenerateColumns" found on the forum to dynamically populate data from the database in Telerik.Reporting.Table.


	private void table1_ItemDataBinding(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.Table processingTable = (sender as Telerik.Reporting.Processing.Table);
            processingTable.DataSource = _dataTable;
 
            //create two HtmlTextBox items (one for header and one for data) which would be added to the items collection of the table
            Telerik.Reporting.HtmlTextBox textboxGroup;
            Telerik.Reporting.HtmlTextBox textBoxTable;
 
            //we do not clear the Rows collection, since we have a details row group and need to create columns only
            this.table1.ColumnGroups.Clear();
            this.table1.Body.Columns.Clear();
            this.table1.Body.Rows.Clear();
            int i = 0;
            this.table1.ColumnHeadersPrintOnEveryPage = true;
            foreach (DataColumn dc in _report.ReportData.Columns)
            {
                Telerik.Reporting.TableGroup tableGroupColumn = new Telerik.Reporting.TableGroup();
                this.table1.ColumnGroups.Add(tableGroupColumn);
                this.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));
                this.table1.Body.SetCellContent(0, i++, textBoxTable);
                this.table1.Items.AddRange(new ReportItemBase[] { textBoxTable, textboxGroup });
            }
        }
the DataTable is a very simple two-column table : Employee Name / Employee Email address The below exception is thrown for each email address table cell when the table is generated :
System.Xml.XmlException: The '@' character, hexadecimal value 0x40, cannot be included in a name. Line 1, position 30.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseElement()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at Telerik.Reporting.HtmlEngine.HtmlParser.ParseHtmlNode(XmlReader reader)
   at Telerik.Reporting.HtmlEngine.HtmlParser.Parse()
   at Telerik.Reporting.HtmlEngine.HtmlParser.Parse(String html, ReportObject parent)
   at Telerik.Reporting.Processing.HtmlTextBox.ProcessItem()
   at Telerik.Reporting.Processing.ReportItemBase.Process(DataMember data)


Please advise

Thanks
Paulino

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 29 Sep 2012, 05:47 PM
Hi Paulino,

Judging by the error (which is a generic .net error) it sounds like you're passing invalid XHTML to the HtmlTextBox. Please post a sample HTML markup that you're providing to the HtmlTextBox so we can review it and provide advice. Also you can use the W3 validator to check your HTML and make sure it is valid.

Regards,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Paulino De Assis Fong
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or