1
votes

I am fetching data from DB and assign it to repeater.

When I click on button event it only goes to page load function but not to the required on-click event. I am confused as to why this is happening.

And when I comment out repeater its working fine. I don't why it's not working with repeater in page load.

Aspx code:

<form runat="server">
  <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
  <asp:UpdatePanel runat="server"  pdateMode="Conditional"  ChildrenAsTriggers="true" >
    <asp:Button ID="Button2" runat="server" Text="Next Availabilities" 
        OnClick="Button2_Click" />

    <asp:Repeater id="repeater1" runat="server">
      <ItemTemplate>
        <asp:Label ID="Label2" runat="server" Text=""><%# Eval("Time") %></asp:Label>
      </ItemTemplate>
    </asp:Repeater>

    </ContentTemplate>
    <Triggers>
      <asp:AsyncPostBackTrigger ControlID ="Button3" EventName ="Click" />
      <asp:AsyncPostBackTrigger ControlID ="Button2" EventName ="Click" />
    </Triggers>
  </asp:UpdatePanel>
</form>
1

1 Answers

0
votes

In your UpdatePanel:

  • Correct pdateMode to UpdateMode
  • Remove ChildrenAsTriggers="true"
  • Add starting tag of <ContentTemplate>
  • Assign id ID="UpdatePanel1"

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>