[CLOSED] [1.0] TextField and HtmlEncode

  1. #1

    [CLOSED] [1.0] TextField and HtmlEncode

    Hi,

    I use TextField and I prepare data (string) for it on the server side in an Ajax event. I encode the string using HttpUtility.HtmlEncode. Then, on the client side, I just set use the setValue() method on the TextField to set the string. This works fine for e.g. < and > tags, but not for the single quote character. HttpUtility encodes it as &#39; and TextField displays it exacatly as &#39; instead of the single quote character. Is there a way around this?

    Regards,
    Tadeusz
    Last edited by geoffrey.mcgill; Aug 02, 2010 at 8:23 PM.
  2. #2
    Hi,

    Can you provide test sample which demonstrates the scenario?
  3. #3
    I think your're getting some double encoding. I tried to reproduce, but was unable.

    Please post a code sample, and/or modify the following to demonstrate the problem.

    Example

    <%@ Page Language="C#" ValidateRequest="false" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <script runat="server">
        protected void Button1_Click(object sender, DirectEventArgs e)
        {
            this.Label1.Text = this.TextField1.Text;
    
            this.TextField1.Text = "<happy> world's </happy>";
        }
    </script>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:TextField ID="TextField1" runat="server" Text="happy <world>'s happy" />
            
            <ext:Button runat="server" Text="Submit" OnDirectClick="Button1_Click" />
            
            <ext:Label ID="Label1" runat="server" />
        </form>
    </body>
    </html>
    Geoffrey McGill
    Founder
  4. #4
    Apologies for not replying to it earlier - I had my mail notifications turned off by mistake. Anyway, I no longer seem to have this problem.
  5. #5
    Hi,

    Thank you for the feedback.

Similar Threads

  1. [CLOSED] Problem with HtmlEncode / HtmlDecode
    By eaglemobile in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 18, 2011, 2:42 PM
  2. [CLOSED] How to use HtmlEncode w/Ext controls
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 16
    Last Post: Sep 13, 2010, 6:53 PM
  3. [CLOSED] htmlEncode and HtmlEditor (Coolite 0.7)
    By macap in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 03, 2009, 5:52 AM
  4. Htmlencode and labels - possible bug?
    By plykkegaard in forum 1.x Help
    Replies: 2
    Last Post: Apr 30, 2009, 11:12 AM
  5. JsonReader - Htmlencode Specific Fields
    By jp500 in forum 1.x Help
    Replies: 0
    Last Post: Nov 12, 2008, 7:50 PM

Posting Permissions