locked
how to add custom buttons in (HtmlEditorExtender) RRS feed

All replies

  • User2103319870 posted

    that  when i save the text and it's go to my database it's come with html tags is there is a way to remove the tags before it saves in the database 

    AFAIK there is feature from HTMLEditor to remove the html tags. You may need to come up with custom implementation to remove the html tags. Below are couple of options

                HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
    //Load the text from Editor here //Change the Textbox id here as per your design doc.LoadHtml(TextBox3.Text);
    //Remove all html tags from string, You can use this value to save to database string result = HttpUtility.HtmlDecode(doc.DocumentNode.InnerText); //Your code to save the data in database
    • Using Regex to remove tags and get only text string
    //Remove all tags from editor content
    string result = System.Text.RegularExpressions.Regex.Replace(TextBox3.Text, "<.*?>", String.Empty);
    
    //Your logic to save the data into database
    Sunday, March 5, 2017 7:35 PM
  • User-1502805872 posted

    thank u so much it's work but i have a problem now when i try to Update it's  give me another design like an example when i  add a NewsText i change the Layout and give a colors and everything and when i save to the to the database the tags gone and that is ok but when i try to select the news to Update something in the NewsText it's change the Layout so how can i save the tags to show it to user when he try to Update the news after he saved it and this is image for my Select 
    http://www8.0zz0.com/2017/03/06/00/805191528.png

    Sunday, March 5, 2017 9:14 PM
  • User2103319870 posted

    when i  add a NewsText i change the Layout and give a colors and everything and when i save to the to the database the tags gone and that is ok but when i try to select the news to Update something in the NewsText it's change the Layout so how can i save the tags to show it to user when he try to Update the news after he saved it and this is image for my Select 

    Once you remove the style tags then you wont be able to add it while displaying it to user. if you want the styles to be applied in editor, then you need to save the content with all styles(html content)

    Sunday, March 5, 2017 11:29 PM
  • User-1502805872 posted

    ok  thank u so much u help me a lot

    Monday, March 6, 2017 12:15 PM
  • User-271186128 posted

    Hi Abdulrahman,

    1 - that  when i save the text and it's go to my database it's come with html tags is there is a way to remove the tags before it saves in the database 

    As A2H said, you could save the content with all styles(html content) into the database, then, if you want to display the content without the html tags, you could use the HtmlAgilityPack or Regex to remove the tags.

    2 - i want to add custom buttons in the HtmlEditorExtender i want to add emoji(Emotion) like this web site http://ajaxtoolkit.net/HTMLEditor/OtherSamples/EditorWithCustomButtons_1.aspx but i didn't know how to add it 

    As for this issue, with refer to the Ajax Control Toolkit document, it seems we can't add button in the HtmlEditorExtender, but we could insert image into HtmlEditor.

     If you want to add emoji in the HtmlEditor, I suggest you could display the Add image button and take the advantage to upload and insert images from the HtmlEditorExtender.

    More details, see:

    https://ajaxcontroltoolkit.devexpress.com/HtmlEditorExtender/HtmlEditorExtender.aspx

    Best regards,
    Dillion

    Friday, March 10, 2017 2:39 AM