我在我的网站中使用 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/