Loading...

DataPager


DataPager Example
Description:
Description for item 1
Percent: 1.23%
Product picture
Description:
Description for item 2
Percent: 2.46%
Product picture

 1 2 3  ...  
@inherits ControlComponent
@inject HttpClient Http

<table>
                                            <tr>
                                            <asp.ListView @ref="this.listView" ID="ListView1" DataSourceID="FreeDataSource1">
                                            <ItemTemplate TItem="Sample">
                                            <td>
                    Description: <br />
                                            @context.StringValue
                                            <br />
                    Percent: @string.Format("{0:P2}", @context.CurrencyValue)
                                            <br />
                                            <asp.Image AlternateText="Product picture"
                                            ImageUrl="@("img/" + context.ImageValue)" />
                                            </td>
                                            </ItemTemplate>
                                            </asp.ListView>
                                            </tr>
</table>

<asp.FreeDataSource ID="FreeDataSource1" PaginationControlID="Pagination1"
                                            OnExecuteSelected="sender => this.data" />

<asp.Pagination ID="Pagination1" PagerControlID="DataPager1"
                                            OnSelectedPageChanging="this.Pagination_SelectedPageChanging" />

<br />

<asp.DataPager ID="DataPager1" PageSize="2">
                                            <Fields>
                                            <asp.NextPreviousPagerField ButtonType="ButtonType.Image"
                                            ShowFirstPageButton="true"
                                            ShowNextPageButton="false"
                                            ShowPreviousPageButton="false"
                                            FirstPageImageUrl="img/first.png" />
                                            <asp.NumericPagerField ButtonCount="3" />
                                            <asp.NextPreviousPagerField ButtonType="ButtonType.Image"
                                            ShowLastPageButton="true"
                                            ShowNextPageButton="false"
                                            ShowPreviousPageButton="false"
                                            LastPageImageUrl="img/last.png" />
                                            </Fields>
</asp.DataPager>

@code {
                                            private Sample[] data;
                                            private ListView listView;

                                            protected override async Task OnInitializedAsync()
    {
        data = await Http.GetFromJsonAsync<Sample[]>("sample-data/sample.json");
    }

                                            private void Pagination_SelectedPageChanging(object sender, PaginationEventArgs e)
    {
        listView.DataBind();
    }

                                            public class Sample
    {
                                            public int IntegerValue { get; set; }

                                            public string StringValue { get; set; }

                                            public double CurrencyValue { get; set; }

                                            public string ImageValue { get; set; }
    }
}

DataPager Metadata
Name Type Kind
Attributes IReadOnlyDictionary Parameter
ChildLevel Int32 Parameter
ClientIDMode ClientIDMode Parameter
ID String Parameter
PagedControlID String Parameter
PageSize Int32 Parameter
Visible Boolean Parameter
OnDataBinding EventHandler Event
OnDisposed EventHandler Event
OnInit EventHandler Event
OnLoad EventHandler Event
OnPreRender EventHandler Event
OnUnload EventHandler Event
ButtonCssClass String Parameter
ButtonType ButtonType Parameter
FirstPageImageUrl String Parameter
FirstPageText String Parameter
LastPageImageUrl String Parameter
LastPageText String Parameter
NextPageImageUrl String Parameter
NextPageText String Parameter
PreviousPageImageUrl String Parameter
PreviousPageText String Parameter
RenderDisabledButtonsAsLabels Boolean Parameter
RenderNonBreakingSpacesBetweenControls Boolean Parameter
ShowFirstPageButton Boolean Parameter
ShowLastPageButton Boolean Parameter
ShowNextPageButton Boolean Parameter
ShowPreviousPageButton Boolean Parameter
Visible String Parameter
ButtonCount Int32 Parameter
ButtonType ButtonType Parameter
CurrentPageLabelCssClass String Parameter
NextPageImageUrl String Parameter
NextPageText String Parameter
NextPreviousButtonCssClass String Parameter
NumericButtonCssClass String Parameter
PreviousPageImageUrl String Parameter
PreviousPageText String Parameter
RenderNonBreakingSpacesBetweenControls Boolean Parameter
Visible String Parameter
Visible String Parameter
OnPagerCommand EventHandler Event
Copyright © 2024 Jurio li All rights reserved.
An unhandled error has occurred. Reload 🗙