3

我在用户控件中有一个 gridview

 <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>

和回发代码

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

然后我有一个 PageIndexChanging 事件,当我点击分页时它永远不会触发。

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

谁能给我任何可能的理由?

4

1 回答 1

2

这可能是您的用户控件与gridview 无关的问题。专注于那部分

于 2013-02-08T05:28:51.123 回答