【发布时间】:2011-07-18 16:41:48
【问题描述】:
我在我的 aspx 页面中使用了两个更新面板。我的页面还包含其他控件,其中大部分是文本框。一些使用 ajaxwater 标记扩展器的文本框。我的问题是当面板的部分更新时,水印文本框也更新了。我怎样才能防止这种情况发生? 我的页面就像 ....一些其他控件,然后
<asp:UpdatePanel runat="server" ID="upPanelTestRoll">
<ContentTemplate>
<fieldset style="height: 70px; float: left; width: 350px;">
<legend>Submission</legend>
<asp:CheckBox ID="chkSubmitted" runat="server" Height="25px" Width="25px" AutoPostBack="true" />
<label for="chkSubmitted">
Submitted</label>
<label for="txtSubmissionDate">
Submission Date</label>
<asp:TextBox ID="txtSubmissionDate" runat="server" Height="12px" Enabled="false"></asp:TextBox>
<cc1:CalendarExtender ID="txtSubmissionDate_CalendarExtender" runat="server" Enabled="True"
TargetControlID="txtSubmissionDate">
</cc1:CalendarExtender>
<%--<asp:CheckBox ID="chkTestToAppear" runat="server" Height="25px" Width="25px" />
<label for="">
Test To Appear</label>--%>
<br />
<label for="txtAdmissionTestRoll">
Admission Test Roll
</label>
<asp:TextBox ID="txtAdmissionTestRoll" runat="server" Enabled="false"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
如何优化代码?
【问题讨论】:
-
我不明白这个问题。如果您只想更新页面的某些部分,则必须在相应的 UpdatePanel 上调用 Update(如果设置为 Conditional)。如果你不想更新的控件在这个UpdatePanel里面,你必须把它分成两个UpdatePanel,这样只会更新正确的那个。
标签: .net asp.net ajax updatepanel