我有 3 个文本框,一个在更新面板中,它每 4 秒刷新一次。在刷新期间,不在更新面板中的控件也会失去焦点。我想继续关注这些控件。
这是我的代码:
<asp:UpdatePanel ID="upnlChat" runat="server">
<ContentTemplate >
<asp:TextBox ID="txtChatBox" ReadOnly="true" TextMode="MultiLine"
CssClass="mymultitextboxclass" runat="server"></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="timerChat" />
</Triggers>
</asp:UpdatePanel>
<asp:Timer ID="timerChat" Interval="4000" runat="server" ontick="timerChat_Tick" ></asp:Timer>
<table>
<tr><td>User: </td><td colspan="2"><asp:TextBox ID="txtUser" runat="server" ></asp:TextBox><br /></td>
<td>
<asp:RequiredFieldValidator ID="RequiredUserName" runat="server" ErrorMessage="Username Required" ControlToValidate="txtUser" ></asp:RequiredFieldValidator> </td></tr>
<tr><td>Message: </td><td><asp:TextBox ID="txtMsg" CssClass="mymsg" TextMode="MultiLine" onkeydown="if (event.keyCode == 13) { btnSend.focus(); this.form.submit(); }" runat="server"></asp:TextBox></td>
<td colspan="2"><asp:Button ID="btnSend" runat="server" onclick="btnSend_Click"
OnClientClick="scroll()" Text="send" />
</td></tr>
</table>
谁能帮帮我吗?