3

I hav 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 code in postback

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

then i had a PageIndexChanging event which never fires when i click on paging.

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

can any one give me any possible reasons?

Amarnath Balasubramanian
  • 9,300
  • 8
  • 34
  • 62
None
  • 5,582
  • 21
  • 85
  • 170
  • Have you stepped through your code? – codingbiz Feb 01 '13 at 11:04
  • @codingbiz:yes, i had put break point and checked everything.when i click paging the only place code execution goes is page load event – None Feb 01 '13 at 11:06
  • Try taking your pager settings out and add page size attribute to gridview definition. On the page you are hosting the control are there any field validations required? This could be blocking the submission of your form to the server. – Laird Streak Feb 01 '13 at 11:06
  • @LairdStreak:removing the PagerSettings never made any change in the problem – None Feb 01 '13 at 11:16
  • The code looks all good try removing the "grdMissingFilterData_PageIndexChanging" from the grid and binding the event in the page_preinit looks something like this grdMissingFilterData.grdMissingFilterData_PageIndexChanging += grdMissingFilterData_PageIndexChanging(); – Laird Streak Feb 01 '13 at 12:18
  • What did you determine was your problem on this? – Flea Jul 12 '13 at 15:31

1 Answers1

2

This may be probably an issue with your user control not about gridview. Focus on that part