how to use Pager control in listview without page refreshing

<asp:ListView ID="lstinfo" runat="server" OnPagePropertiesChanging="PropertiesChanging_lstinfoPager" >
    <LayoutTemplate>
<LayoutTemplate>
<ItemTemplate>
</ItemTemplate>
 </asp:listview>

<!-- Data Pager -->
    <div style="float:right;">
     <asp:DataPager ID="lstinfoPager" runat="server" PagedControlID="lstinfo"
    PageSize="5" >
    <Fields>
        <asp:NextPreviousPagerField ShowNextPageButton="false" ShowFirstPageButton="True" ButtonCssClass="pager"  />
        <asp:NumericPagerField CurrentPageLabelCssClass="current" NumericButtonCssClass="pager"  />
        <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False" ButtonCssClass="pager" />
    </Fields>
</asp:DataPager>



protected void PropertiesChanging_lstinfoPager(object sender, PagePropertiesChangingEventArgs e)
        {
            lstinfoPager.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
            BindRecord();
        }

public void BindRecord()
{
       //Bind the listview
      lstinfo.DataSource = Your_datasource;
     lstinfo.DataBind();
}

No comments:

Post a Comment