ITSagar ITSagar - 1 year ago 74
C# Question

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

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

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:DataList ID="DataList1" runat="server" onitemdatabound="DataList1_ItemDataBound" RepeatLayout="Flow">
<div class="post-heading">
<div class="pull-left image">
<img src="" class="img-circle avatar" alt="user profile image">
<div class="pull-left meta">
<div class="title h5">
<a href="#"><b>Ryan Haywood</b></a>
made a post.
<h6 class="text-muted time">1 minute ago</h6>
<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 href="#" class="btn btn-default stat-item">
<i class="fa fa-share icon"></i>12
<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>
<asp:Button ID="Button2" class="btn-block btn-primary" runat="server" Text="Load More" onclick="Button2_Click" ClientIDMode="Static" />
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />

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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download