I have a ListView control that is inside of an update panel. I have a Button control that calls code behind when clicked and I have a trigger in the update panel that is triggered based on the click event of the button. The button that calls the code behind and inserts a record into the database works fine but I get a full page refresh and the ListView Data is not updated as expected. I then can go to another page, come back and the new data is there. I'm not sure what I missing. Please see the code below.
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<asp:ListView ID="ListView2" runat="server" DataSourceID="sdsrcMessageComments" DataKeyNames="MessageId"
ItemPlaceholderID="PlaceHolder2" EnableViewState="False">
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="PlaceHolder2"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<div style="background-color: #E4E4E4; margin-left: 25px">
<img src="Images/<%# Eval("Picture") %>" alt="Picture" height="25" width="25" />
<asp:Label ID="lblUserHistName" runat="server" Text='<%# Eval("UserFullName") %>'
Font-Bold="True" />
<br />
<asp:Label ID="Label2" runat="server" Text='<%# Eval("MessageDetail") %>' Width="350px" /><br />
<asp:LinkButton ID="lbtnEnjoy" runat="server" Font-Size="Smaller" CommandArgument='<%# Eval("MessageId") %>'
OnCommand="SetMessageEnjoy_Click">Enjoy</asp:LinkButton></span><div style="float: right;
font-size: small; font-style: italic; color: #0000FF;">
<%# Eval("Days_Hours_Minutes")%></div>
<hr />
</div>
</ItemTemplate>
</asp:ListView>
<div style="margin-left: 25px; border-style: groove; background-color: #E4E4E4" >
<img src="Images/<%# Eval("Picture")%>" alt="Picture" height="25" width="25" />
<asp:TextBox ID="txtMsgComment_1" runat="server" Width="405px" Height="25px" Font-Italic="False"
TextMode="MultiLine" AutoPostBack="True" EnableViewState="False"></asp:TextBox>
<asp:Button ID="btnMsgComment_1" runat="server" UseSubmitBehavior="false" CommandArgument='<%# Eval("MessageId") %>' CommandName="Click" OnCommand="AddComment_Click"
Text="Send" Visible="True" />
<ajaxToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender4" runat="server"
WatermarkText="Share Your Thoughts with this Comment..." TargetControlID="txtMsgComment_1"
WatermarkCssClass="watermark" Enabled="True">
</ajaxToolkit:TextBoxWatermarkExtender>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnMsgComment_1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>