Asp.net 更新控制面板
更新面板有问题。我制作了这个表,在这个表中我有两个标签(“lblResult”和“lblCheat”),每次单击按钮“btnCheck”或“ImageButton1”时,我都需要更新它们。 单击“下一步”按钮时,整个表都会更新,它与我的代码配合得很好 我不明白为什么标签没有更新,因为我使用更新面板的方式与“btnNext”按钮、“btnCheck”和“ImageButton1”相同Asp.net 更新控制面板,asp.net,ajax,Asp.net,Ajax,更新面板有问题。我制作了这个表,在这个表中我有两个标签(“lblResult”和“lblCheat”),每次单击按钮“btnCheck”或“ImageButton1”时,我都需要更新它们。 单击“下一步”按钮时,整个表都会更新,它与我的代码配合得很好 我不明白为什么标签没有更新,因为我使用更新面板的方式与“btnNext”按钮、“btnCheck”和“ImageButton1”相同 提前谢谢 尝试设置嵌套的更新面板UpdateMode=“Conditional” 见本章: 具体阅读“Upda
提前谢谢 尝试设置嵌套的更新面板
UpdateMode=“Conditional”
见本章:
具体阅读“UpdatePanel控件是如何刷新的”,它实际上讨论了UpdateMode和嵌套更新面板
更新面板需要一点时间才能使用:)尝试设置嵌套的更新面板UpdateMode=“Conditional”。还有,只是检查一下,页面上有ScriptManager吗?@Mausimo,UpdateMode=“Conditional”和ChildrenAsTriggers=“false”解决了我的问题。我想会的。想让我给你一个答案,这样你就可以结束这个问题了?
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<center>
<asp:Label ID="lblSound" runat="server" Visible="False"></asp:Label>
<table>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Sentence: "></asp:Label></td>
<td colspan="2">
<center>
<asp:Label ID="lblSentence" runat="server" Text=""></asp:Label>
</center>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Audio: "></asp:Label>
</td>
<td colspan="2">
<audio controls="">
<source src="Sound/<%=FilePath %>" />
</audio>
</td>
</tr>
<tr>
<td style="height: 11px">
<asp:Label ID="Label1" runat="server" Text="Write the correct word: "></asp:Label>
</td>
<td style="height: 11px">
<asp:TextBox ID="txtWord" runat="server" ontextchanged="txtWord_TextChanged"></asp:TextBox>
</td>
<td style="height: 11px">
<center>
<asp:Button ID="btnCheck" runat="server" onclick="btnCheck_Click"
Text="Check" />
<asp:ImageButton ID="ImageButton1" runat="server" Height="30px"
ImageUrl="~/Besilka/Question-mark-icon.png" onclick="ImageButton1_Click"
Width="30px" />
</center>
</td>
</tr>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<tr>
<td>
<center>
<asp:Label ID="lblResult" runat="server"></asp:Label>
</center>
</td>
<td>
<center>
<asp:Label ID="lblCheat" runat="server" Text=""></asp:Label>
</center>
</td>
</tr>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnCheck" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="ImageButton1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</table>
</center>
<asp:Button ID="btnNext" runat="server" onclick="btnNext_Click" Text="Next" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnNext" EventName="Click" />
</Triggers>
</asp:UpdatePanel>