c# - 使用 HTMLEditorExtender 的文本框在按 Enter 时不会插入新行

标签 c# asp.net ajax ajaxcontroltoolkit htmleditorextender

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

<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>

运行应用程序,并在 TextBox2 获得焦点时按 Enter,没有插入新行; 相反,TextBox2 失去了焦点

这不会发生除非 HTMLEditorExtender 附加到TextBox2

更多详情

我正在本地 IIS 中运行应用程序。该网站已上线,但该功能尚未在主网站上启动。我正在使用 ASP.NET WebForms 和最新的 AjaxToolkit 版本。这个问题也存在于所有浏览器中,包括 Chrome、IE、Opera、Firefox。

最佳答案

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

关于c# - 使用 HTMLEditorExtender 的文本框在按 Enter 时不会插入新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15173473/

相关文章:

c# - UWP 如何显示来自网络目录的图像

c# - 如何在数组中搜索特定字符以及如何在 C# 中操作该索引

c# - 如何在不使用 Loop 的情况下更改 List<UIControl> 中控件的属性?

jquery同步发布

ajax - 您如何将值传递给 ajax 监听器primefaces

C# - 使用子类实现接口(interface)

asp.net - 将字符串数组作为参数传递给 asp.net mvc webapi 方法

asp.net - VB.NET - 将 WinForm 应用程序导出/转换为 Web ASP.NET 应用程序的最简单方法

c# - 使用 asp.net 发送邮件以及嵌入的图像

jquery - 在Ajax Jquery函数中添加if else函数