HtML TEXT Box Control

6 posts, 2 answers
  1. Farrukh
    Farrukh avatar
    12 posts
    Member since:
    May 2009

    Posted 19 Jan 2012 Link to this post

    We are using HtmlTextbox for reporting english and arabic data because exporting to word file doesn't work fine with database column directly .Now porblem in htmltextbox is, if data have wild character like  (&, /,$ , ; ) it gives error "An error has accured while processing HtmlTextBox".Kindly gives us solution as soon as possible thanks.
  2. Answer
    Steve
    Admin
    Steve avatar
    10941 posts

    Posted 19 Jan 2012 Link to this post

    Hi Farrukh,

    According to the HTML specification (and the general XML specification) the "&", "<" and ">" characters are considered special (markup delimiters), so they need to be encoded in order to be treated as regular text. For example the "&" character can be escaped with the "&amp;" entity. More information on the subject you can find in this w3.org article.

    Kind regards,
    Steve
    the Telerik team

    Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

  3. DevCraft banner
  4. Bob
    Bob avatar
    7 posts
    Member since:
    Sep 2012

    Posted 03 Apr 2014 in reply to Steve Link to this post

    I have been having some issues with the "&" and the htmlTextBox. Until now I have been able to escape it with the "&amp;" by executing a "Replace("&",""&amp;") in the SQL code for the SqlDataSource SelectCommand. We now have to attach the same command to an Access 2007 database. Access does not support the remote execution of the "Replace" command so I can't escape it using SQL. How can I escape the command using the "Replace" command in the report expression?

    The statement below does not work.

    design view:
    {Replace(Fields.CurrentAssee,"&","&amp;")}{Fields.incareOf}
    {Fields.streetAddress}
    {Fields.City}, {Fields.state}
    {Fields.zip}

    html View
    {Replace(Fields.CurrentAssee,"&amp;","&amp;amp;")}{Fields.incareOf}<br />{Fields.streetAddress}<br />{Fields.City},&nbsp;{Fields.state} {Fields.zip}

    Thanks,

    bobn :>)
  5. Stef
    Admin
    Stef avatar
    3050 posts

    Posted 07 Apr 2014 Link to this post

    Hi Bob,

    At our side using the Replace Text function in the Html view of the HtmlTextBox works as expected:
    the tested expression:
    {Replace("test&test","&","&")}

    You can also use a custom function to escape special characters.

    If you need further help, feel free to open a support ticket and send us a sample report with your settings and test data to run it.

    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.

     
  6. Bob
    Bob avatar
    7 posts
    Member since:
    Sep 2012

    Posted 07 Apr 2014 in reply to Stef Link to this post

    I see that you are referencing the HtmlTextbox from the "Design View". There is no need to escape "Test & Test" as the input as it translates the value as "Test &amp; Test" in the html view. Try data binding the value "Test & Test" and passing it into the textbox and then tell me how it works out. As far as custom functions go, I was never able to use a custom function, it reports and error "The expression contains undefined function call Replace().
    {TAXI.Classes.ReportFunctions.Replace(Fields.CurrentAssee,"&", "&amp;")}{Fields.incareOf}
    {Fields.streetAddress}
    {Fields.City}, {Fields.state}
    {Fields.zip}

    Thanks, Bobn :>)
  7. Answer
    Stef
    Admin
    Stef avatar
    3050 posts

    Posted 10 Apr 2014 Link to this post

    Hello,

    You can find attached a sample report definition, illustrating our test to escape the & symbol in a text coming from the data.

    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.

     
Back to Top
DevCraft banner