Gridview PageIndexChanging event not firing

I have a gridview inside a usercontrol

 <asp:GridView ID="grdMissingFilterData" runat="server"   AllowPaging="True" Width="100%"
                        AllowSorting="True" AutoGenerateColumns="False" GridLines="None"
                        PageSize="30" OnPageIndexChanging="grdMissingFilterData_PageIndexChanging">
                        <Columns>
                            <asp:BoundField DataField="Varenummer" HeaderText="Varenummer"   ItemStyle-Width="25%" >
                            <ItemStyle Width="25%" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Varenavn" HeaderText="Varenavn"  ItemStyle-Width="15%" >
                            <ItemStyle Width="15%" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Producentvarenummer" HeaderText="Producent varenummer"  ItemStyle-Width="15%" >
                            <ItemStyle Width="15%" />
                            </asp:BoundField>
                        </Columns>
                        <AlternatingRowStyle CssClass="altrow" />
                        <PagerSettings FirstPageText="First" LastPageText="Last" PageButtonCount="50" />
                        <EmptyDataTemplate>
                            There is no data available to display!
                        </EmptyDataTemplate>
   <PagerStyle CssClass="pager" />
    </asp:GridView>

      

and the code in postback

if (!Page.IsPostBack)
    {  
        BindData(); 
    }

      

then I had a PageIndexChanging event that never fires when I click on the paging.

 protected void grdMissingFilterData_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    grdMissingFilterData.PageIndex = e.NewPageIndex;
    BindData();
}

      

can anyone give me possible reasons?

+3


source to share


1 answer


Maybe this could be a problem with your custom control and not with the gridview. Focus on this part



+2


source







All Articles