【发布时间】:2011-08-17 01:47:04
【问题描述】:
我在这样的页面上有一个 UpdatePanel 和一个文本区域:
<asp:Timer runat="server" ID="Timer" Interval="1000" OnTick="Tick" />
<asp:UpdatePanel runat="server" id="UpdatePanel" updatemode="Conditional">
<ContentTemplate>
<asp:Label ID="Label" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger controlid="Timer" eventname="Tick" />
</Triggers>
</asp:UpdatePanel>
<asp:TextBox runat="server" Width="600" Height="400" TextMode="MultiLine" />
// Codebehind
protected void Tick(object sender, EventArgs e) {
Label.Text = DateTime.Now.ToString();
}
每当 UpdatePanel 计时器触发时,文本区域中的光标就会移动到文本的末尾。如果您尝试将任何文本添加到文本区域的中间,则由于光标一直跳到末尾,这将变得非常困难。这仅发生在IE8中。所有其他浏览器都非常乐意让您在文本的中间键入 而不会出现问题。
知道为什么会在 IE 中发生这种情况以及如何阻止它吗?
【问题讨论】:
标签: c# asp.net internet-explorer-8 updatepanel textarea