开发者

ASP.NET Update Panel Updates only Once

Hi I have an Update Panel like this

<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>

I want to update the label everytime one of the above triggers happens.

The first time I trigger it everything works perfectly fine. Bu开发者_JAVA技巧t after that there are no more updates even if I change anything (It is like all Control's AutoPostBack get set to false after the first Partial Post back, so nothing happens when i change the selection a second time).

Any help is greatly appreciated

Thank you


Copy and Paste this .. works fine :)

<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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜