ASP.NET Update Panel Updates only Once

3.7k views Asked by At

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

1

There are 1 answers

0
a7mad.3ezz On

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>