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

HTMLTextBox throwing an error

6 Answers 780 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Enigma
Top achievements
Rank 1
Enigma asked on 19 Feb 2015, 04:12 PM
An error has occurred while processing HtmlTextBox 'htmlTextBox1': An error occurred while parsing EntityName. Line 1, position 102.

Attached is the detail show the text in a regular textbox and in htmltextbox

6 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 24 Feb 2015, 11:24 AM
Hi Enigma,

Please double-check if the string set as HtmlTextBox.Value is escaped correctly. By design, the approach to work with the HtmlTextBox and escape HTML special characters would be to send the data (html code) to a user function which will escape the HTML special characters. You can also validate the passed value - XHTML Validation.

For more information on the above approach, please check the User Functions help article, as well as the HtmlEncode Method MSDN page.



I hope the provided information is helpful.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Abhinav
Top achievements
Rank 1
answered on 27 Jul 2015, 11:50 AM

Hello,

The HtmlTextBox is generating the error(i.e.,  An error occurred while parsing EntityName.) when we provide any string which contains any html tag. 

 Example: "Case: 97 | Part: Part A | Type: Single<br/>Domain: A-COMPCARE (1) | Subject: 11YO- Issues of foster care, possible abuse & psychiatric issues<br/>"

Please suggest. 

 

 

0
Stef
Telerik team
answered on 27 Jul 2015, 02:27 PM
Hi Abhinav,

The provided HTML string is invalid as special characters like '&' are not escaped. Also the BR tag is not supported by the HtmlTextBox item. Please check the overview article for a list of the supported HTML elements and CSS attributes.

The best approach is to escape and modify the string in a user function before passing as an HtmlTextBox.Value.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
1
jLz
Top achievements
Rank 1
answered on 26 Aug 2015, 04:37 PM
The data source, replace "&" with "&#38;", thus there will be no error.
0
ibrahim
Top achievements
Rank 1
answered on 01 Aug 2017, 03:27 PM
Ndnd
1
Nathan
Top achievements
Rank 1
Iron
answered on 13 Jul 2021, 08:52 PM

In C# use:

value = WebUtility.HtmlEncode(text);
So you don't have to replace all html characters.
Tags
General Discussions
Asked by
Enigma
Top achievements
Rank 1
Answers by
Stef
Telerik team
Abhinav
Top achievements
Rank 1
jLz
Top achievements
Rank 1
ibrahim
Top achievements
Rank 1
Nathan
Top achievements
Rank 1
Iron
Share this question
or