Click here to Skip to main content
12,944,121 members (52,059 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
how to enable paging for gridview in asp.net using vb.net code
Posted 1-Oct-11 1:28am
Comments
King_Fisher 31-Jan-14 7:22am
   
got the answer?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

GridView Custom Paging[^]

Also Try this one.....:)

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 6

protected void grvDetails_PageIndexChanging(object sender, GridViewPageEventArgs e)
       {
           grvDetails.PageIndex = e.NewPageIndex;
           bindGrid();
       }
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

select gridview ->goto properties window ->click on events button

double click on pageindexchanging event

and set

Allowpaging=true for gridview

in pageindex changing event write the following code
gridview1.pageindex=e.newpageindex;
//gridbindingcode
gridview1.databind();
 
  Permalink  
Comments
v.sdivya 1-Oct-11 10:35am
   
thank you...I tried with this coding, but next page is not getting loaded...I have used a single gridview for viewing details date wise(using calendar) and also for viewing fully.how to use paging here?
RAKESH CHAUBEY 2-Nov-12 14:02pm
   
Plz Check allow paging is true or not .And Just for one time set page size =2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Set allowpaging property of grid view to true

and set pagesize property to no of records you want in each page.

in pageindex changing event write the following code

gridview1.pageindex=e.newpageindex;
 
gridview1.databind();
  Permalink  
v3
Comments
v.sdivya 1-Oct-11 10:34am
   
thank you...I tried with this coding, but next page is not getting loaded...I have used a single gridview for viewing details date wise(using calendar) and also for viewing fully.how to use paging here?
v.sdivya 2-Oct-11 16:00pm
   
Please reply .
RAKESH CHAUBEY 2-Nov-12 14:01pm
   
grvDetails.PageIndex = e.NewPageIndex;
bindGrid();
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

In pge index changing event write the following code

protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
   gridView.PageIndex = e.NewPageIndex;
   gridView.DataBind();
}
  Permalink  
v2
Comments
v.sdivya 1-Oct-11 10:35am
   
thank you...I tried with this coding, but next page is not getting loaded...I have used a single gridview for viewing details date wise(using calendar) and also for viewing fully.how to use paging here?
omarabbasaj 6-Nov-13 4:16am
   
<asp:GridView AllowPaging="True|False" />


<%@ Page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>GridView AllowPaging Example</title>
</head>
<body>
<form id="form1" runat="server">

GridView AllowPaging Example



<asp:gridview id="CustomersGridView"
datasourceid="CustomersSource"
autogeneratecolumns="true"
emptydatatext="No data available."
allowpaging="true"
runat="server">

<pagersettings mode="Numeric"
position="Bottom"
pagebuttoncount="10"/>

<pagerstyle backcolor="LightBlue"
height="30px"
verticalalign="Bottom"
horizontalalign="Center"/>



<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Northwind sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:sqldatasource id="CustomersSource"
selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>

</form>
</body>
</html>
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 11

<asp:GridView ID="grd_EmployeeList" runat="server" AutoGenerateColumns="False" 
BackColor="White"
DataKeyNames="fEmpID" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="0px" CellPadding="3" CssClass="controlsFontStyle" ForeColor="Black" HeaderStyle-Height="22px" Height="22px" RowStyle-Height="22px" OnSelectedIndexChanging="SelectedIndexChanging_Click" OnRowCommand="OnRowCommand_Click" ShowHeaderWhenEmpty="True" Width="100%" PageSize="15" AllowPaging="True" EnableSortingAndPagingCallbacks="true" onpageindexchanging=" grd_EmployeeList_PageIndexChanging">
  Permalink  

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
OriginalGriff 4,653
CHill60 2,970
Maciej Los 2,388
Jochen Arndt 1,900
ppolymorphe 1,765


Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 19 May 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100