Click here to Skip to main content
15,887,476 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone ,
in gridview who is fetching thousands of records .i allowpaging "true" ,but next page of gridview is not showing data .
Thanks in advance
Posted
Comments
Ali Al Omairi(Abu AlHassan) 12-May-12 5:09am    
did you handle PageIndexChanging and PageIndexChanged events?

Apart from setting AllowPaging property to true, you need to handle the PageIndexChanged event where you move to next page and bind the data with grid.

Have a look here on how it is implemented and try out:
MSDN: GridView.PageIndexChanged Event[^]
 
Share this answer
 
Hello !! Check this It will be Helpfull to u.


Give Allow Paging = True;

and write this below code in PageIndeX changing.


C#
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {

        GridView1.PageIndex = e.NewPageIndex;
        GridView1.DataBind();

}
 
Share this answer
 
Comments
kunalkumarsingh 16-May-12 3:43am    
I handeled the pageindexchangig event even still not showing next page.
Ubaid ur Rahman IT 16-May-12 4:59am    
can u please display ur design and code page here....lets we check and give ua perfect answer.
kunalkumarsingh 28-May-12 5:08am    
how to display design and code page here can you help me.
Thank you.
Syed SufiyanUddin 28-May-12 6:36am    
Just copy and paste ur code here
kunalkumarsingh 28-May-12 6:46am    
protected void btn_viewingrid_Click(object sender, EventArgs e)
{
SqlDataAdapter da = new SqlDataAdapter("select * from CONTAINERSIN where Conti_Depot='" + txt_Dptno.Text + "' ", con);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void GridView1_PageIndexChanged(object sender, EventArgs e)
{

}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}

// SOURCE CODE


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="0" ForeColor="#333333" GridLines="Horizontal"
AllowPaging="True"
onpageindexchanging="GridView1_PageIndexChanging" onselectedindexchanged="GridView1_SelectedIndexChanged2"
>
<footerstyle backcolor="#5D7B9D" font-bold="True" forecolor="White">
<rowstyle backcolor="#F7F6F3" forecolor="#333333">
<columns>
<asp:BoundField DataField="CONTI_ID" HeaderText="DTL NO" />
<asp:BoundField DataField="Conti_Depot" HeaderText="CONT SIZE" />
<asp:BoundField DataField="CONTI_SHPLINE" HeaderText="CONT NO" />
<asp:BoundField DataField="CONTI_INDATE" HeaderText="SHIPPING LINE" />
<asp:BoundField DataField="Conti_InDate" HeaderText="IN DATE" />


<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<editrowstyle backcolor="#999999">
<alternatingrowstyle backcolor="White" forecolor="#284775">
Try this:

ASP.Net 2.0 Gridview Paging using C#[^]

hope it helps :)
 
Share this answer
 
Comments
Ranjith Reddy CSE 30-May-12 7:07am    
My Dear Friend, Use PageIndexingChanging event......and delete page index changed event....from design and code....may be it will run.
Ranjith Reddy CSE 30-May-12 7:10am    
and also delete Selected index changed event also.....ok.

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



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