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

Html Text Box Handling Special Characters

3 Answers 977 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 19 Jul 2014, 04:35 AM
Hi,  
     I use stored procedures and sql queries to get data for my report parameters and the report data. The idea is to let user select from dropdown values and filter the required data. In one of the html styled text box, I need to present the user selected multi-values of a dropdown...

I used this..

Schools: {Join('; ', Parameters.SchoolNames.Value)}

that just works fine....

But the problem is the parameter values some times may contain '&'.. Thats throwing me an error.. Then I realised that I have to escape it for HTML Text box....

How can I do this in my scenario.. I have tried, the following with no luck..

Schools: {Join('; ',Replace(Parameters.SchoolNames.Value,'&','&'))}     







3 Answers, 1 is accepted

Sort by
0
Accepted
Nasko
Telerik team
answered on 21 Jul 2014, 12:50 PM
Hello Daniel,

The correct approach to escape the HTML special characters would be to send the data fields/report parameters to a user function which will escape the HTML special characters:

{MyUserFunction(Join('; ', Parameters.SchoolNames.Value))}

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

Regards,
Nasko
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
Gurmeet Singh
Top achievements
Rank 1
answered on 16 Jan 2015, 05:11 AM
Hi Team

We are also facing the same issue while generating the pdf from telerik reporting, with a special character {. We have tried htmlencode but it has no impact on the character {  and }.

0
Nasko
Telerik team
answered on 20 Jan 2015, 02:58 PM
Hello Gurmeet,

In case you are using Embedded Expressions in the HtmlTextBox item, curly brackets - { } should be escaped with double brackets like this: {{ or }}.

Regards,
Nasko
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.

 
Tags
Report Designer (standalone)
Asked by
Daniel
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Gurmeet Singh
Top achievements
Rank 1
Share this question
or