Click here to Skip to main content
14,694,018 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I have a parent Gridview and in each row have a gridview childrent have pagging.

When parent Gridview in pageindex = 0, paging of gridview childrent is working. BUT, parent Gridview have pageindex != 0, paging of gridview childrent not working.

Here is my gridview:

<asp:GridView AllowPaging="true" ID="grvReport">
  <Columns>
    <ItemTemplate>
       <asp:GridView AllowPaging="true" ID="grdDetail" OnPageIndexChanging="grdDetail_PageIndexChanging">
          <Columns>
             <ItemTemplate>
               //Some control
             </ItemTemplate>
          </Columns>
       </asp:GridView>
  </ItemTemplate>
 </Columns>
</asp:GridView>


What I have tried:

protected void grdDetail_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
  GetData(new Pager(int.MaxValue, 0));
  BA_WebGPS.UIL.Controls.GridView grvDetail = (sender as BA_WebGPS.UIL.Controls.GridView);
  int rowIndex = ((GridViewRow)grvDetail.Parent.Parent.Parent).RowIndex;
  GridIndexDetail = rowIndex;
  long vehicleID = long.Parse(grvReport.DataKeys[rowIndex].Value.ToString());
  grvDetail.PageIndex = e.NewPageIndex;
  grvDetail.DataSource = BaseManager.LstFullDataDetail.Where(x => x.VehicleID == vehicleID).ToList();
  grvDetail.DataBind();

}
Posted
Updated 15-Jul-20 1:16am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900