这可能吗?我有一个 AJAX TabContainer,容器中有 3 个选项卡。在选项卡 #2 上,我有一个复选框,选中后会启用一个文本框。未选中复选框时,应禁用文本框。
我的 ASP 表单中有此代码:
<AJAXControls:TabContainer runat="server" ID="tabContainer" Height="373" Width="900" >
<AJAXControls:TabPanel ID="firstTab" HeaderText="First Tab" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server">You are in the First tab.</asp:Label>
</ContentTemplate>
</AJAXControls:TabPanel>
<AJAXControls:TabPanel ID="secondTab" HeaderText="Second Tab" runat="server">
<ContentTemplate>
<div>
<asp:Panel ID="Panel1" runat="server" Height="70px" style="margin-left: 19px"
Width="860px" BorderStyle="Groove" BorderWidth="2px">
<table>
<tr>
<td width="170">Review Validated:</td>
<td width="50"><asp:CheckBox ID="chkRevVal" runat="server" Text=" " oncheckedchanged="chkRevVal_CheckedChanged" AutoPostBack="true" /></td>
<td width="40"></td>
<td width="170">Validation Comments:</td>
<td width="380" rowspan = "4"><asp:textbox id="txtValComm" runat="server" textmode="multiline" rows="4" Width="380px"></asp:textbox></td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
</table>
</asp:Panel>
</ContentTemplate>
</AJAXControls:TabPanel>
</AJAXControls:TabContainer>
我在我的代码隐藏中有这个:
protected void chkRevVal_CheckedChanged(object sender, EventArgs e)
{
if (chkRevVal.Checked == true)
{
this.txtValComm.Enabled = true;
this.txtValComm.Focus();
}
}
问题是,当我选中该框时,TabContainer 每次都会返回到选项卡 #1。选中复选框后,有没有办法将其保留在选项卡 #2 上?