我有一个简单的测试页,其中包含一个包含复选框的UpdatePanel。复选框更改后,我希望该UpdatePanel中发生某些事情(目前,我的代码只是更改UpdatePanel中按钮的文本。
问题在于,我可以定期看到整个页面被刷新,而不仅仅是UpdatePanel。我没有看到正常的模式,但是在复选框上单击五分之一可能会刷新整个页面。为什么会这样?
我尝试过IE和Chrome-两者都做同样的事情。
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager2" EnablePartialRendering="true" runat="server" />
<asp:UpdatePanel runat="server" ID="updatepanel1" UpdateMode="Conditional">
<ContentTemplate>
<div style="align:center; margin-left:350px; margin-top:150px">
<asp:CheckBox ID="test_cbx" runat="server" Text="Include Inactive" Font-Size="X-Small" AutoPostBack="true" OnCheckedChanged="HandleCheckboxChange" OnClientClick="return false;" />
<br />
<asp:Button ID="btnUpload" Text="Get Data" runat="server" onclick="btnGet_Click" /><br /><br />
<div class="GridviewDiv">
[RESULTS]
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="test_cbx" />
<asp:PostBackTrigger ControlID="btnUpload" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="updatepanel2" UpdateMode="Conditional">
<ContentTemplate>
<div style="align:center; margin-left:350px; margin-top:150px">
<table>
<tr>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
</tr>
<tr>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
</tr>
<tr>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
</tr>
<tr>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
</tr>
<tr>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
</tr>
<tr>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
</tr>
<tr>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
</tr>
<tr>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
</tr>
<tr>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
</tr>
<tr>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
<td>ABCDEFG</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>
当我单击复选框时,我不希望看到任何完整的页面更新,但是确实会发生。仅更新UpdatePanel时,浏览器选项卡上的页面标题是否应该刷新?对我来说,每当我单击复选框时,它都会刷新。