嗨,我有一个像这样的更新面板
<asp:UpdatePanel ID="Updatepanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="RadioButtons1" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="DropDown1" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="DropDown2" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="DropDown3" EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:Label runat="server" Text="LabelToUpdate"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>每次发生上述触发事件时,我都要更新标签。
当我第一次触发它时,一切都运行得很好。但在那之后,即使我更改了任何内容,也没有更多的更新(这就像是在第一次部分回发后,所有控件的AutoPostBack都被设置为false,所以当我第二次更改选择时没有任何反应)。
非常感谢您的任何帮助。
谢谢
发布于 2011-10-24 00:47:10
复制并粘贴此文件..工作正常:)
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:RadioButtonList ID="RadioButtons1" runat="server" AutoPostBack="true">
<asp:ListItem Text="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="2"></asp:ListItem>
<asp:ListItem Text="3"></asp:ListItem>
<asp:ListItem Text="4"></asp:ListItem>
</asp:RadioButtonList>
<br />
<asp:DropDownList ID="DropDown1" runat="server" AutoPostBack="true">
<asp:ListItem Text="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="2"></asp:ListItem>
<asp:ListItem Text="3"></asp:ListItem>
<asp:ListItem Text="4"></asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:DropDownList ID="DropDown2" runat="server" AutoPostBack="true">
<asp:ListItem Text="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="2"></asp:ListItem>
<asp:ListItem Text="3"></asp:ListItem>
<asp:ListItem Text="4"></asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:DropDownList ID="DropDown3" runat="server" AutoPostBack="true">
<asp:ListItem Text="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="2"></asp:ListItem>
<asp:ListItem Text="3"></asp:ListItem>
<asp:ListItem Text="4"></asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:UpdatePanel ID="Updatepanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="RadioButtons1" />
<asp:AsyncPostBackTrigger ControlID="DropDown1" />
<asp:AsyncPostBackTrigger ControlID="DropDown2" />
<asp:AsyncPostBackTrigger ControlID="DropDown3" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="LabelToUpdate"><%= "rad: " + RadioButtons1.SelectedItem.Text + "<br />" + "drop1: " + DropDown1.SelectedItem.Text + "<br />" + "drop2: " + DropDown2.SelectedItem.Text + "<br />" + "drop3: " + DropDown3.SelectedItem.Text %></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>https://stackoverflow.com/questions/7787361
复制相似问题