Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day, this is driving me absolutely crazy trying to solve this so after seven frustrating hours, I'll ask the question. I have an htmleditorextender on a page. I can type content into it and it saves to the database just fine on submit - formatted and unformatted. However, if I paste content into it from the clipboard (ctl v), nothing gets carried over to the database. I can't for the life of me see what I'm missing ... here is the relevant section of code... and many thanks for looking at this...

VB
<asp:Label ID="Label2" runat="server" Text="Today's entry"></asp:Label><br />
    <ajaxToolkit:HtmlEditorExtender ID="HtmlEditorExtender1" 
        DisplaySourceTab="True"  runat="server" 
        TargetControlID="BContent">
         <Toolbar> 
                <ajaxToolkit:Cut />
                <ajaxToolkit:Copy />
                <ajaxToolkit:Paste />
                <ajaxToolkit:CreateLink />
                <ajaxToolkit:UnLink />
                <ajaxToolkit:RemoveFormat />
                <ajaxToolkit:SelectAll />
                <ajaxToolkit:UnSelect />
                <ajaxToolkit:Delete />
                </Toolbar>
    </ajaxToolkit:HtmlEditorExtender>

    <asp:TextBox ID="BContent" runat="server" Rows="16" TextMode="MultiLine" 
        Width="689px"></asp:TextBox>
Posted
Comments
And how you are saving the content to database?
So, BContent.Text is the parameter, which is the Text inside Extender, right?
Member 10722372 25-Apr-14 14:19pm    
Yes, that is correct. And like I said, it works great if I physically type into BContent. But if I ctl-v any content into it, text or rtf, nothing carries over to the Insert. Baffling to me. :)
But it is working for me.
Sunasara Imdadhusen 26-Apr-14 5:26am    
please use improve question option instead of adding answer in comment section

1 solution

Okay, well, I got it partly working. As you'll see in my original source code, I only have some of the buttons included. Once I started including all the buttons in the menu, it started working.

That said, it's not working well - not translating some closing tags correctly, stripping out some paragraph and line break tags, and it won't allow me to embed YouTube embed code (which I presume in the santizer). So basically, unless I can resolve those issues, this is still a clunky, problematic part of my project ... any tips on these issues in this paragraph are greatly appreciated. Or if there's a way to still have it accept a paste without having to have all the icon options in the menu. I really don't want people bolding and centering and doing weird stuff to the content they post. Cheers to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900