IE8 cursor jumps to the end of a textarea when an UpdatePanel fires
I have an UpdatePanel and a textarea on a page like this:
<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:Upda开发者_如何学PythontePanel>
<asp:TextBox runat="server" Width="600" Height="400" TextMode="MultiLine" />
// Codebehind
protected void Tick(object sender, EventArgs e) {
Label.Text = DateTime.Now.ToString();
}
Whenever the UpdatePanel timer fires, the cursor in the textarea moves to the end of the text. If you try to add any text to the middle of the text area it becomes very difficult as the cursor keeps jumping to the end. This only happens in IE8. All other browsers are perfectly happy to let you type in the middle of the text without issue.
Any idea why this happens in IE and how to stop it?
I believe IE8 has a known text area bug.
Try setting the min-width and max-width to be the same value.
Just to make sure, if you use Compatibility Mode, does this error occur?
textarea {
width: 700px;
min-width: 100%;
max-width: 100%;
}
You might also want to set a fixed pixel height
property.
精彩评论