C # - asp: событие щелчка DataPager - PullRequest
0 голосов
/ 24 ноября 2018

Я хочу, чтобы, если пользователи нажимали на любую кнопку DataPager, например «Далее, 1,2,3 .., Пред.код, который я пишу:

ASPX:

<asp:ListView ID="ListofEmployees" runat="server" OnPagePropertiesChanging="ListofEmployees_PagePropertiesChanging">
    <LayoutTemplate>
        <ItemTemplate>
            ...
        </ItemTemplate>
    </LayoutTemplate>
<asp:DataPager ID="lvDataPager1" runat="server" PagedControlID="ListofEmployees" PageSize="9" >
    <Fields>
        <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="false" ShowPreviousPageButton="true"
                            ShowNextPageButton="false" PreviousPageText="<"  />
        <asp:NumericPagerField ButtonType="Link" NumericButtonCssClass="page-number" ButtonCount="5" />
        <asp:NextPreviousPagerField ButtonType="Link" ShowNextPageButton="true" ShowLastPageButton="false"
                            ShowPreviousPageButton="false" NextPageText=">" />
    </Fields>
</asp:DataPager>

C #:

protected void ListofEmployees_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
    {
        foreach (DataPagerFieldItem dpfItem in dtpPaging.Controls)
            {
                foreach (Control cPagerControls in dpfItem.Controls)
                    {
                        // I want to write to write a code here if any pagination button is clicked
                             booleanValue = true;
                    }
            {
    }
...