0

I have the following gridview and want to enable paging.

<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" 
        GridLines="None" AutoGenerateColumns="False" Height="168px" BorderStyle="Solid" 
         Width="120%" PageSize="5" AllowPaging="true" 
         >
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
            <asp:BoundField DataField="ActionDate" HeaderText="Action Date" />
            <asp:BoundField DataField="CustomerFirstName" HeaderText="Name" />
            <asp:BoundField DataField="CustomerLastName" HeaderText="Last Name" />
            <asp:BoundField DataField="CustomerCompany" HeaderText="Company/Organisation" />
            <asp:BoundField DataField="CustomerPosition" HeaderText="Position" />
            <asp:BoundField DataField="CustomerCountry" HeaderText="Country" />
            <asp:BoundField DataField="CustomerProvince" HeaderText="Province" />
            <asp:BoundField DataField="CustomerContact" HeaderText="Contact" />
            <asp:BoundField DataField="CustomerEmail" HeaderText="Email Address" />
            <asp:BoundField DataField="ProductCode" HeaderText="Product code" />
        </Columns>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>

I get the following error.

'GridView1' fired event PageIndexChanging which wasn't handled. 

I How can I handle the paging event of this grid view

Arianule
  • 8,811
  • 45
  • 116
  • 174
  • 1
    Possible Duplicate : http://stackoverflow.com/questions/5672463/gridview1-fired-event-pageindexchanging-which-wasnt-handled Hoped that helped you. – QzSG Jan 14 '13 at 14:49
  • see [http://stackoverflow.com/questions/5382477/...](http://stackoverflow.com/questions/5382477/gridview-pageindexchanging-not-working). Seems like you need to add PageIndexChanging event in your code – Gabriel GM Jan 14 '13 at 14:51

1 Answers1

1

Please read this article:

http://www.c-sharpcorner.com/UploadFile/rohatash/gridview-paging-sample-in-Asp-Net/

In this article you can find step by step explanation how to implement paging in ASP.NET

Especially please look if you have in code-behind that kind of event handler:

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
Piotr Czarnecki
  • 1,688
  • 3
  • 14
  • 22