Html Text Box Handling Special Characters

4 posts, 1 answers
  1. Daniel
    Daniel avatar
    1 posts
    Member since:
    Jul 2013

    Posted 18 Jul 2014 Link to this post

    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,'&','&'))}     







  2. Answer
    Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 21 Jul 2014 Link to this post

    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.

     
  3. DevCraft banner
  4. Gurmeet Singh
    Gurmeet Singh avatar
    2 posts
    Member since:
    Sep 2012

    Posted 15 Jan 2015 Link to this post

    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 }.

  5. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 20 Jan 2015 Link to this post

    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.

     
Back to Top