ITSagar
ITSagar

Reputation: 703

Update Panel not working asynchronously

I have a Master page where I have placed a Script Manager as under:

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

In content page, I have an Update Panel with the Datalist and a Button as follows:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DataList ID="DataList1" runat="server" onitemdatabound="DataList1_ItemDataBound" RepeatLayout="Flow">
<ItemTemplate>
 <div class="post-heading">
  <div class="pull-left image">
    <img src="http://bootdey.com/img/Content/user_1.jpg" class="img-circle avatar" alt="user profile image">
  </div>
 <div class="pull-left meta">
  <div class="title h5">
   <a href="#"><b>Ryan Haywood</b></a>
    made a post.
  </div>
  <h6 class="text-muted time">1 minute ago</h6>
 </div>
</div> 
<div class="post-description"> 
 <asp:Image ID="Image2" class="img img-responsive" ImageUrl='<%#Eval ("pimg") %>' runat="server" />
 <p><asp:Label ID="postlabel" class="postlabel" runat="server" Text='<%#Eval ("ptext") %>'></asp:Label></p>
 <div class="stats">
  <a href="#" class="btn btn-default stat-item">
   <i class="fa fa-thumbs-up icon"></i>2
  </a>
  <a href="#" class="btn btn-default stat-item">
   <i class="fa fa-share icon"></i>12
  </a>
 </div>
</div>
<div class="post-footer">
 <div class="input-group"> 
  <input class="form-control" placeholder="Add a comment" type="text">
   <span class="input-group-addon">
    <a href="#"><i class="fa fa-edit"></i></a>  
   </span>
 </div>
</div>
</ItemTemplate>
</asp:DataList>
<asp:Button ID="Button2" class="btn-block btn-primary" runat="server" Text="Load More" onclick="Button2_Click" ClientIDMode="Static" />
</ContentTemplate>
<Triggers>
 <asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

The problem is that when I click on this Load More button, data is fetched fine but full page postback is happening instead of partial postback. Why and how it can be resolved?

Upvotes: 1

Views: 558

Answers (1)

Shobhit Gupta
Shobhit Gupta

Reputation: 690

your questions are always out of the box. I mean, I always see your questions with some unique issues that are hard to rectify. Why is that so??? :P bye the way, you code looks absolutely fine. I ran into a similar issue days back and figured out that for some extra designing, I was referring to an online Javascript library. As soon as I removed the link, things started working. I really needed those resources and tried to replace it with the css link, and it worked fine. Give it a try, may be you are running with the same issue.

Upvotes: 1

Related Questions