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

HtmlTextBox

11 Answers 576 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Geejay
Top achievements
Rank 1
Geejay asked on 15 Apr 2009, 03:24 PM
Hello,

I'm having difficulty with populating the new HtmlTextBox-item with data from a databasefield. Whatever I seem to do, I'm getting errors when then report is rendered. 
What I''m having in designtime in the code window of the HtmlTextBox (as I do in normal Textboxes) is this: = Fields.Verslag.
What I'm getting after rendering is an error (in the HtmlTextBox) which says: An error has occured while processing HtmlTextBox 'HtmlTextBox1': The 'BR' start tag on line 1 does not match the end tag of 'html'. Line 1, position 2069.
However, when I copy and paste the data from the field in the code window manually , the rendering is correct.
What am I doing wrong, I'm trying for hours now.

regards, Geert 

11 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 16 Apr 2009, 07:31 AM
Hi Geejay,

Can you please paste the html markup contained within that field? Once we test on our end, we would be able to provide you with more info.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Geejay
Top achievements
Rank 1
answered on 16 Apr 2009, 07:46 AM
Hi Steve,

I should have thought about an example when I made the post!

regards Geert


<FONT style="BACKGROUND-COLOR: #f3f6f1">TIQ= 106<BR>
VIQ= 110<BR>
PIQ= 99<BR>
<BR>
Verbaal begrip: 117<BR>
Perceptuele organisatie: 101<BR>
Verwerkingssnelheid: 97<BR>
</FONT>
0
Steve
Telerik team
answered on 16 Apr 2009, 11:48 AM
Hi Geejay,

Thank you for the sample code, now it is clear where the problem comes from. Your BR tags are missing the closing "/" and therefore are not parsed correctly. We currently do a replace and handle unclose tags before the parsing, but only for lowercase html elements. Now that you've hit this is it obvious it would be best to do it for uppercase as well.
The best way to fix this would be to add closing "/" to your <br> elements, as your markup is not valid xhtml this way.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Geejay
Top achievements
Rank 1
answered on 16 Apr 2009, 12:10 PM
Hi Steve,

oke, thats clear. The uppercase <BR> is generated by the RadEditor.Net2.dll. Should an update to the RadEditor Ajax Version solve the problem? Or, of course,  I could do a replace in code before saving it to the database.

Regards Geert

1
Accepted
Steve
Telerik team
answered on 16 Apr 2009, 12:23 PM
Hello Geejay,

The problem is not whether the html markup is lower or uppercase. The HtmlTextBox (as browsers) handle both cases, the problem is that currently we only handle the case when the closing "/" is missing for lowercase markup i.e.
  • if you have <br> we would replace it with <br/> and parse the html correctly
  • if you have <BR>, the replace action would not kick in and therefore the error. We would be able to handle uppercase for subsequent versions.
As for the RadEditor, I just checked the "HTML" view of this ticket reply and I see that it has generated lowercase <br/> tags with closing "/", so I am not sure how you've got the uppercase ones without closing "/". If you've somehow managed to do that, you can contact my colleagues from RadEditor's team for more info.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Geejay
Top achievements
Rank 1
answered on 16 Apr 2009, 12:42 PM
Hi Steve,

I understand that the uppercase causes problems for the replace action, not for the HTML parsing.
I don't do anything special to get the Uppercase <BR> without the closing tag, I just hit the Enter key!
For your interest, I just adjusted my code to do a replace to lowercase <br> and now the report works fine.

Regards Geert
0
Geejay
Top achievements
Rank 1
answered on 16 Apr 2009, 12:58 PM
For anyone's interest, I just found out in this post that converting HTML tags to uppercase is typically for IE, but you can set a property in RadEditor (ConvertToXhtml) to correct this.

Greetings Geert
0
Daniel
Top achievements
Rank 1
answered on 12 Jan 2010, 03:41 PM
Hi,

I am trying to show on one of my reports some HTML formatted data that comes from an external source. I am using a HTMLTextbox item, but the problem is that when the HTML data is not correctly formatted, my report shows an error ("An error has occured while processing HtmlTextBox..."). What I would like to do is check the HTML content to see if it would render correctly and if not, use the StripHtmlTags method on the data (this way the user would still see some data then no data at all). I could use the method that Telerik is using to determine if the HTML data is correctly formatted. Is there a way I can access that method? Do you have any other solution for my problem?

Thanks,
Daniel
0
Steve
Telerik team
answered on 13 Jan 2010, 08:26 AM
Hello Daniel,

All supported html tags and css attributes are listed in our HtmlTextBox help article, so if it is throwing an error, the markup is not valid XHTML and there must be unsupported tags/attributes in the HTML you provide that we for some reason cannot strip and in this line of thoughts using our method would not be of help. What you need to do is pinpoint the exact cause for the problem and let us know if you believe this should be handled on our end. For the time being you can correct the problem by introducing your own method (a user function) that alters the wrong HTML and returns a valid XHTML markup.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Daniel
Top achievements
Rank 1
answered on 14 Jan 2010, 10:21 AM
Hi Steve,

The problem is not that I cannot use the StripHtmlTags method. I CAN use it and it DOES strip the html tags . The text that I want to bind to my HtmlTextbox is usually XHTML valid, but sometimes it is incomplete (end tags missing error).
What I would like to do is call the parsing method you use for determining if the bound text is a valid XHTML content in order to avoid a red unwanted error message in my report saying that "An error has occured while processing HtmlTextBox 'HtmlTextBox1'".
Something like this:
if (HTMLIsRendable(IncomingHTMLText))
{
    HtmlTextBox1.Value = IncomingHTMLText;
}
else
{
  if (TryToFix(IncomingHTMLText))
    {
        HtmlTextBox1.Value = FixedIncomingHTMLText;
    }
    else
    {
        HtmlTextBox1.Value = StripHTMLTags(IncomingHTMLText); 
    }
}

HTMLIsRendable is the method I was looking for, that is the method you use to determine the validity of the HtmlTextbox value. I know that I could try to write my own parsing method, but it would have to behave exactly like your 'HTMLIsRendable' method in order for the above scenario to work. 

Regards,
Daniel
0
Steve
Telerik team
answered on 14 Jan 2010, 04:01 PM
Hello Daniel,

Thank you for the additional clarification - now it makes much more sense and we agree that exposing this method would be a nice functionality for scenarios like yours. We've logged this in our features list and it would be considered for implementation in a subsequent version of the product. Unfortunately there is no other workaround we can offer than the one posted in previous post.

Your Telerik points have been updated for bringing this to our attention. Do let us know if other ideas/suggestions come to mind.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Geejay
Top achievements
Rank 1
Answers by
Steve
Telerik team
Geejay
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Share this question
or