Search code examples
c#asp.netlistviewupdatepanel

ASP.NET Appending Data to a ListView without refreshing entire ListView


I've created a ListView inside an UpdatePanel that loads data without the page having to refresh. However, I need to append data one by one to the existing ListView instead of reloading the entire ListView. I realized that it's possible using the Telerik Library but I need to do it without it.

Can yall help out a bit please :)

Telerik: http://demos.telerik.com/aspnet-ajax/listview/examples/client/appendingdata/defaultcs.aspx

My Normal ASP.NET ListView:

<asp:UpdatePanel ID="activityUpdatePanel" runat="server" OnLoad="activityUpdatePanel_Load" > 

          <ContentTemplate>

                  <asp:ListView ID="activityListView"  runat="server" ItemPlaceholderID="itemPlaceHolder1">

                          <LayoutTemplate>

                                  <asp:PlaceHolder runat="server" ID="itemPlaceHolder1"></asp:PlaceHolder>

                          </LayoutTemplate>

        <ItemTemplate>
</asp:ListView>


Solution

  • under trigger add one button and write your save code in that button and after successfull insertion write listview bind code. inside that button only add here you button

    protected void btn_save() { '' write your save code

    if(saved success) { '' bind listview code here } }