1

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

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
Y2theZ
  • 10,162
  • 38
  • 131
  • 200
  • What do you mean by "all the triggers AutoPostBack get set to false"? – Tim Schmelter Oct 16 '11 at 21:43
  • Hi, Sorry for that confusion. I mean nothing will post back anymore on the page. When I change the value of the drop downs and the radio button lists nothing happens. It is like they don't do anymore postbacks – Y2theZ Oct 16 '11 at 21:44
  • Are you databinding these controls on postback? You should embed it in an `if(!Page.IsPostBack)`-check. Are these controls dynamically created? You know that the control-id must be the same on every postback to trigger the events? Have you debugged to see if page_load is handled? Do you see any javascript errors on page? – Tim Schmelter Oct 16 '11 at 22:19
  • 1- Databinding on postback : no 2- embed it in an if(!Page.IsPostBack) : I use this check to set the default values. I didn't undertand what you mean. 3- Are these controls dynamically created?: No. But I am creating other controls on postbacks. (I create other labels in the update panel) 4- the control-id must be the same on every postback: It is the same I don't change anything with the controls that trigger the update panel. 5-page_load is handled? It is not handled. Nothing happens when I change the selections 6- Do you see any javascript errors on page: No- I'm not using any javascript – Y2theZ Oct 16 '11 at 23:27
  • Maybe you should post the actual code – aquinas Oct 17 '11 at 00:09

1 Answers1

0

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>
a7mad.3ezz
  • 101
  • 1
  • 6