按Enter键时,使用HTMLEditorExtender的TextBox不会插入新行

Shi*_*eek 6 c# asp.net ajax ajaxcontroltoolkit htmleditorextender

我HTMLEditorExtender在我的网站上使用AjaxToolKit的控件.标记如下:

<asp:TextBox ID="TextBox2" runat="server" 
        Font-Names="'lucida grande',tahoma,verdana,arial,sans-serif" Height="100%" OnTextChanged="TextBox2_TextChanged" 
        style="margin-bottom: 26px; font-size: small;" Width="90%"></asp:TextBox>

<asp:HtmlEditorExtender ID="TextBox2_HtmlEditorExtender" runat="server" 
        Enabled="True" TargetControlID="TextBox2">
    <Toolbar>
        <asp:Undo />
        <asp:Redo />
        <asp:Bold />
        <asp:Italic />
        <asp:Underline />
        <asp:StrikeThrough />
        <asp:Subscript />
        <asp:Superscript />
        <asp:InsertOrderedList />
        <asp:InsertUnorderedList />
        <asp:RemoveFormat />
        <asp:SelectAll />
        <asp:UnSelect />
        <asp:Delete />
        <asp:Cut />
        <asp:Copy />
        <asp:Paste />
        <asp:Indent />
        <asp:Outdent />
        <asp:FontNameSelector />
    </Toolbar>
</asp:HtmlEditorExtender>
Run Code Online (Sandbox Code Playgroud)

运行应用程序,并在有焦点时按Enter键TextBox2,不会插入新行; 相反,TextBox2失去了焦点.

这不会发生,除非将HTMLEditorExtender连接到TextBox2.

更多细节

我在本地IIS中运行该应用程序.该网站已上线但该功能尚未在主网站上推出.我正在使用ASP.NET WebForms和最新的AjaxToolkit版本.此问题也出现在每个浏览器中,包括Chrome,IE,Opera,Firefox.

Shi*_*eek 4

最后我自己解决了这个错误。我提供的代码包含在具有默认按钮的面板中。所以我删除了 DefaultButton 属性,代码现在工作正常。感谢大家添加您的回复。