Programmatically setting .Text

Last post 06-29-2011, 7:22 AM by Concoxide. 5 replies.
Sort Posts: Previous Next
  •  06-27-2011, 11:32 AM 68175

    Programmatically setting .Text


    I am having an issue with programmatically setting the .Text property with a string that contains rich text characters.
     
    If I manually copy and paste text with rich text characters in the editor, it converts them to html entities just fine . . . but when set programmatically it does not . . .they show up as unknown characters . . and then when it is saved it converts to groups of strange characters.  Is there any way to get around this?
     
    Thnx in advance.
  •  06-27-2011, 8:32 PM 68181 in reply to 68175

    Re: Programmatically setting .Text

    Hi Concoxide,
     
    Can you paste the code here what you are testing? I will check it and get back to you as soon as possible.
     
    Regards,
     
    Ken
  •  06-28-2011, 10:05 AM 68203 in reply to 68181

    Re: Programmatically setting .Text


    Ok . . I am using the CuteEditor to allow authorized individuals to change the content of a section of a web page.  So with VB.NET I am programmatically setting the current content in the CuteEditor like this:
     
    Editor1.Text = strContent
     
    Now, if that original content has rich text characters in it such as the following:
     
    This is “test” content.
    It will show up in the editor with the white square symbol in place of the opening and closing rich text quotes.
    If you now submit it, (using VB.NET to read from the .Text property of the editor and write it to the file) it shows up on the web page like this:
     
    This is �test� content. 
     
    If programmatically setting the .Text property of the editor could provide the same filtering as manually pasting into the editor it would work correctly.
     
    I have tried using javascript to .SetHTML and also tried .PasteHTML but neither of them seemed to work for me (the editor remained empty) . . could it be that the javascript functionality doesn't work correctly when the editor is runat=server . . ?
     
    Note:   I would prefer to fix this via the vb.net method so if that can be done, i don't need help with the javascript
     
    Thanks.
     
     
  •  06-29-2011, 1:23 AM 68233 in reply to 68203

    Re: Programmatically setting .Text

    Hi Concoxide,
     
    I can not reprodcue this issue. Is your site online? If so, can you paste the test page url? So I can check it for you.
     
    Regards,
     
    Ken
  •  06-29-2011, 3:01 AM 68244 in reply to 68203

    Re: Programmatically setting .Text

    Hi Concoxide,
     
     
    This is Page Encoding and VB.net issue  about special characters.
    I tested the rich text  <
    This is “test” content.>, using .Text property
    It was fine in C#.net but showed  strange characters in VB.net
     
    When I used Response.Write("
    This is “test” content.") in VB.net,
    it also showed strange characters
    You can use C# language on editing page, using the following code
     
    1. <%@ Page Language="C#"%>  
     
    Regards,
    Jeff 
     
  •  06-29-2011, 7:22 AM 68250 in reply to 68244

    Re: Programmatically setting .Text

    Thanks for the tip, i was able to get it to work in VB.NET by reading the content with the encoding as follows
     
    Text.Encoding.GetEncoding("Windows-1252")
     
     
View as RSS news feed in XML